Replace hardcoded DB credentials with environment-driven configuration.

Centralize DB settings in ingestion config, remove embedded secrets from ingestion helpers, and add an idempotent PostgreSQL bootstrap script to create role/database and apply schema safely.

Made-with: Cursor
This commit is contained in:
David Doebel
2026-04-02 16:30:50 +02:00
parent e9b3a4aac3
commit b3663258e4
10 changed files with 189 additions and 35 deletions

View File

@@ -1,13 +1,15 @@
import psycopg2
import pandas as pd
conn = psycopg2.connect(
dbname="options_db",
user="quant_user",
password="strong_password",
host="144.91.73.49",
port="5432"
)
from option_pricing.src.data.ingestion.db_connect import db_engine
cursor = conn.cursor()
cursor.execute("SELECT * FROM underlyings;")
print(cursor.fetchall())
def fetch_underlyings() -> pd.DataFrame:
"""
Fetch all entries from the underlyings table using configured DB credentials.
"""
engine = db_engine()
return pd.read_sql("SELECT * FROM underlyings;", engine)
if __name__ == "__main__":
print(fetch_underlyings())