Loading .gitignore +1 −0 Original line number Diff line number Diff line Loading @@ -2,3 +2,4 @@ *.sw[op] # python build files build/ __pycache__/ docker-compose.yaml +7 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,13 @@ services: build: . volumes: - ./src/:/tmp/src environment: - DATABASE_HOST=postgres - DATABASE_TIMEOUT=60 command: - 'tail' - '-f' - '/dev/null' postgres: image: postgres Loading src/cp/database.py +6 −4 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ class Database(ABC): DEFAULT_TIMEOUT = ce('DATABASE_TIMEOUT', 60) DEFAULT_DB = ce('DATABASE_DB', 'postgres') DEFAULT_USER = ce('DATABASE_USER', 'postgres') DEFAULT_PW = ce('DATABASE_PW', 'posgres') DEFAULT_PW = ce('DATABASE_PW', 'postgres') DEFAULT_HOST = ce('DATABASE_HOST', "localhost") DEFAULT_PORT = int(ce('DATABASE_PORT', 5432)) DEFAULT_SCHEMA = ce('DATABASE_SCHEMA', 'public') Loading Loading @@ -156,9 +156,11 @@ class Database(ABC): def is_open(self): """Determine if the database is open or not.""" # TODO @Jonathan -- code review please if self._cursor is not None and self._connection is not None: # Test if both connection and cursor are on if self._cursor is not None and self._connection is not None: # Test if both connection and cursor are on return True # If both are on, return True return False # If one or both connection and cursor are missing, return False # If one or both connection and cursor are missing, return False return False def return_as_pandas(self, query): """ return a query as a pandas dataframe """ Loading Loading
.gitignore +1 −0 Original line number Diff line number Diff line Loading @@ -2,3 +2,4 @@ *.sw[op] # python build files build/ __pycache__/
docker-compose.yaml +7 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,13 @@ services: build: . volumes: - ./src/:/tmp/src environment: - DATABASE_HOST=postgres - DATABASE_TIMEOUT=60 command: - 'tail' - '-f' - '/dev/null' postgres: image: postgres Loading
src/cp/database.py +6 −4 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ class Database(ABC): DEFAULT_TIMEOUT = ce('DATABASE_TIMEOUT', 60) DEFAULT_DB = ce('DATABASE_DB', 'postgres') DEFAULT_USER = ce('DATABASE_USER', 'postgres') DEFAULT_PW = ce('DATABASE_PW', 'posgres') DEFAULT_PW = ce('DATABASE_PW', 'postgres') DEFAULT_HOST = ce('DATABASE_HOST', "localhost") DEFAULT_PORT = int(ce('DATABASE_PORT', 5432)) DEFAULT_SCHEMA = ce('DATABASE_SCHEMA', 'public') Loading Loading @@ -156,9 +156,11 @@ class Database(ABC): def is_open(self): """Determine if the database is open or not.""" # TODO @Jonathan -- code review please if self._cursor is not None and self._connection is not None: # Test if both connection and cursor are on if self._cursor is not None and self._connection is not None: # Test if both connection and cursor are on return True # If both are on, return True return False # If one or both connection and cursor are missing, return False # If one or both connection and cursor are missing, return False return False def return_as_pandas(self, query): """ return a query as a pandas dataframe """ Loading