fix(trade-dashboard): fix import errors and alembic migration
- database.py: remove dead pre-definition of DATABASE_URL with undefined db_user/db_pass variables - models.py: add missing Table import from sqlalchemy - alembic/env.py: replace deprecated run_async() with asyncio.run() (removed in SQLAlchemy 2.0) - alembic 001_initial: use raw SQL for CREATE TYPE instead of op.create_enum() which requires alembic_postgresql_enum Migration 001_initial successfully applied to trading_data DB.
This commit is contained in:
parent
6599249d65
commit
23c7c707d8
4 changed files with 8 additions and 16 deletions
|
|
@ -1,17 +1,8 @@
|
|||
from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine
|
||||
from sqlalchemy import MetaData
|
||||
|
||||
# Connection to hermes-pgdb CNPG cluster
|
||||
DATABASE_URL = (
|
||||
f"postgresql+asyncpg://{db_user}:{db_pass}"
|
||||
f"@hermes-pgdb-rw.customer1.svc.cluster.local:5432/trading_data"
|
||||
).format(
|
||||
db_user="trading",
|
||||
db_pass="TRADING_DB_PASSWORD", # overridden by env
|
||||
)
|
||||
|
||||
import os
|
||||
|
||||
from sqlalchemy import MetaData
|
||||
from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine
|
||||
|
||||
DB_USER = os.getenv("DB_USER", "trading")
|
||||
DB_PASS = os.getenv("DB_PASSWORD", "")
|
||||
DB_HOST = os.getenv("DB_HOST", "hermes-pgdb-rw.customer1.svc.cluster.local")
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
from sqlalchemy import Column, String, Numeric, Enum, DateTime, JSON, func
|
||||
from sqlalchemy import Column, String, Numeric, Enum, DateTime, JSON, func, Table
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
import uuid
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue