MCPcopy Create free account
hub / github.com/alpha2phi/python-apps / PgSqlDb

Class PgSqlDb

excel-ingester/loader/__init__.py:85–101  ·  view source on GitHub ↗

PostgreSQL database service.

Source from the content-addressed store, hash-verified

83
84@auto_str
85class PgSqlDb:
86 """PostgreSQL database service."""
87
88 def __init__(self, host, port, db, user, password):
89 self._host = host
90 self._port = port
91 self._db = db
92 self._user = user
93 self._password = password
94
95 def get_engine(self):
96 """Create and return sqlalchemy engine."""
97 return create_engine(self.get_conn_str())
98
99 def get_conn_str(self):
100 """Return the connection string."""
101 return f"postgresql+psycopg2://{self._user}:{self._password}@{self._host}:{self._port}/{self._db}"
102
103
104# Register database providers

Callers 1

__call__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected