refactor: multi-dashboard structural migration
Some checks failed
CI / lint-and-test (pull_request) Has been cancelled
Some checks failed
CI / lint-and-test (pull_request) Has been cancelled
- Rename dbt project from toronto_housing to portfolio - Restructure dbt models into domain subdirectories: - shared/ for cross-domain dimensions (dim_time) - staging/toronto/, intermediate/toronto/, marts/toronto/ - Update SQLAlchemy models for raw_toronto schema - Add explicit cross-schema FK relationships for FactRentals - Namespace figure factories under figures/toronto/ - Namespace notebooks under notebooks/toronto/ - Update Makefile with domain-specific targets and env loading - Update all documentation for multi-dashboard structure This enables adding new dashboard projects (e.g., /football, /energy) without structural conflicts or naming collisions. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -15,6 +15,7 @@ from pathlib import Path
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent.parent))
|
||||
|
||||
from portfolio_app.toronto.models import create_tables, get_engine # noqa: E402
|
||||
from portfolio_app.toronto.models.dimensions import RAW_TORONTO_SCHEMA # noqa: E402
|
||||
|
||||
|
||||
def main() -> int:
|
||||
@@ -32,16 +33,30 @@ def main() -> int:
|
||||
result.fetchone()
|
||||
print("Database connection successful")
|
||||
|
||||
# Create domain-specific schemas
|
||||
with engine.connect() as conn:
|
||||
conn.execute(text(f"CREATE SCHEMA IF NOT EXISTS {RAW_TORONTO_SCHEMA}"))
|
||||
conn.commit()
|
||||
print(f"Created schema: {RAW_TORONTO_SCHEMA}")
|
||||
|
||||
# Create all tables
|
||||
create_tables()
|
||||
print("Schema created successfully")
|
||||
|
||||
# List created tables
|
||||
# List created tables by schema
|
||||
from sqlalchemy import inspect
|
||||
|
||||
inspector = inspect(engine)
|
||||
tables = inspector.get_table_names()
|
||||
print(f"Created tables: {', '.join(tables)}")
|
||||
|
||||
# Public schema tables
|
||||
public_tables = inspector.get_table_names(schema="public")
|
||||
if public_tables:
|
||||
print(f"Public schema tables: {', '.join(public_tables)}")
|
||||
|
||||
# raw_toronto schema tables
|
||||
toronto_tables = inspector.get_table_names(schema=RAW_TORONTO_SCHEMA)
|
||||
if toronto_tables:
|
||||
print(f"{RAW_TORONTO_SCHEMA} schema tables: {', '.join(toronto_tables)}")
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user