mirror of
https://github.com/RichieCahill/dotfiles.git
synced 2026-04-17 13:08:19 -04:00
adding data_science_dev
This commit is contained in:
@@ -90,6 +90,13 @@ DATABASES: dict[str, DatabaseConfig] = {
|
|||||||
base_class_name="SignalBotBase",
|
base_class_name="SignalBotBase",
|
||||||
models_module="python.orm.signal_bot.models",
|
models_module="python.orm.signal_bot.models",
|
||||||
),
|
),
|
||||||
|
"data_science_dev": DatabaseConfig(
|
||||||
|
env_prefix="DATA_SCIENCE_DEV",
|
||||||
|
version_location="python/alembic/data_science_dev/versions",
|
||||||
|
base_module="python.orm.data_science_dev.base",
|
||||||
|
base_class_name="DataScienceDevBase",
|
||||||
|
models_module="python.orm.data_science_dev.models",
|
||||||
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
"""ORM package exports."""
|
"""ORM package exports."""
|
||||||
|
|
||||||
|
from python.orm.data_science_dev.base import DataScienceDevBase
|
||||||
from python.orm.richie.base import RichieBase
|
from python.orm.richie.base import RichieBase
|
||||||
from python.orm.signal_bot.base import SignalBotBase
|
from python.orm.signal_bot.base import SignalBotBase
|
||||||
from python.orm.van_inventory.base import VanInventoryBase
|
from python.orm.van_inventory.base import VanInventoryBase
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
|
"DataScienceDevBase",
|
||||||
"RichieBase",
|
"RichieBase",
|
||||||
"SignalBotBase",
|
"SignalBotBase",
|
||||||
"VanInventoryBase",
|
"VanInventoryBase",
|
||||||
|
|||||||
11
python/orm/data_science_dev/__init__.py
Normal file
11
python/orm/data_science_dev/__init__.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
"""Data science dev database ORM exports."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from python.orm.data_science_dev.base import DataScienceDevBase, DataScienceDevTableBase, DataScienceDevTableBaseBig
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"DataScienceDevBase",
|
||||||
|
"DataScienceDevTableBase",
|
||||||
|
"DataScienceDevTableBaseBig",
|
||||||
|
]
|
||||||
52
python/orm/data_science_dev/base.py
Normal file
52
python/orm/data_science_dev/base.py
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
"""Data science dev database ORM base."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
from sqlalchemy import BigInteger, DateTime, MetaData, func
|
||||||
|
from sqlalchemy.ext.declarative import AbstractConcreteBase
|
||||||
|
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
|
||||||
|
|
||||||
|
from python.orm.common import NAMING_CONVENTION
|
||||||
|
|
||||||
|
|
||||||
|
class DataScienceDevBase(DeclarativeBase):
|
||||||
|
"""Base class for data_science_dev database ORM models."""
|
||||||
|
|
||||||
|
schema_name = "main"
|
||||||
|
|
||||||
|
metadata = MetaData(
|
||||||
|
schema=schema_name,
|
||||||
|
naming_convention=NAMING_CONVENTION,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class _TableMixin:
|
||||||
|
"""Shared timestamp columns for all table bases."""
|
||||||
|
|
||||||
|
created: Mapped[datetime] = mapped_column(
|
||||||
|
DateTime(timezone=True),
|
||||||
|
server_default=func.now(),
|
||||||
|
)
|
||||||
|
updated: Mapped[datetime] = mapped_column(
|
||||||
|
DateTime(timezone=True),
|
||||||
|
server_default=func.now(),
|
||||||
|
onupdate=func.now(),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class DataScienceDevTableBase(_TableMixin, AbstractConcreteBase, DataScienceDevBase):
|
||||||
|
"""Table with Integer primary key."""
|
||||||
|
|
||||||
|
__abstract__ = True
|
||||||
|
|
||||||
|
id: Mapped[int] = mapped_column(primary_key=True)
|
||||||
|
|
||||||
|
|
||||||
|
class DataScienceDevTableBaseBig(_TableMixin, AbstractConcreteBase, DataScienceDevBase):
|
||||||
|
"""Table with BigInteger primary key."""
|
||||||
|
|
||||||
|
__abstract__ = True
|
||||||
|
|
||||||
|
id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
|
||||||
3
python/orm/data_science_dev/models.py
Normal file
3
python/orm/data_science_dev/models.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
"""Data science dev database ORM models."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
@@ -39,6 +39,10 @@ in
|
|||||||
host postgres math ::1/128 trust
|
host postgres math ::1/128 trust
|
||||||
host postgres math 192.168.90.1/24 trust
|
host postgres math 192.168.90.1/24 trust
|
||||||
|
|
||||||
|
local data_science_dev math trust
|
||||||
|
host data_science_dev math 127.0.0.1/32 trust
|
||||||
|
host data_science_dev math ::1/128 trust
|
||||||
|
host data_science_dev math 192.168.90.1/24 trust
|
||||||
'';
|
'';
|
||||||
|
|
||||||
identMap = ''
|
identMap = ''
|
||||||
@@ -110,6 +114,7 @@ in
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
ensureDatabases = [
|
ensureDatabases = [
|
||||||
|
"data_science_dev"
|
||||||
"hass"
|
"hass"
|
||||||
"gitea"
|
"gitea"
|
||||||
"math"
|
"math"
|
||||||
|
|||||||
Reference in New Issue
Block a user