maleo-foundation 0.0.62__py3-none-any.whl → 0.0.64__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- maleo_foundation/db/__init__.py +3 -2
- maleo_foundation/db/manager.py +14 -0
- maleo_foundation/db/{database.py → table.py} +4 -18
- {maleo_foundation-0.0.62.dist-info → maleo_foundation-0.0.64.dist-info}/METADATA +1 -1
- {maleo_foundation-0.0.62.dist-info → maleo_foundation-0.0.64.dist-info}/RECORD +7 -6
- {maleo_foundation-0.0.62.dist-info → maleo_foundation-0.0.64.dist-info}/WHEEL +0 -0
- {maleo_foundation-0.0.62.dist-info → maleo_foundation-0.0.64.dist-info}/top_level.txt +0 -0
maleo_foundation/db/__init__.py
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from sqlalchemy import Engine, MetaData
|
|
2
|
+
from sqlalchemy.ext.declarative import DeclarativeMeta
|
|
3
|
+
from sqlalchemy.orm import declarative_base
|
|
4
|
+
|
|
5
|
+
class DatabaseManager:
|
|
6
|
+
Base:DeclarativeMeta = declarative_base() #* Correct way to define a declarative base
|
|
7
|
+
|
|
8
|
+
#* Explicitly define the type of metadata
|
|
9
|
+
metadata:MetaData = Base.metadata
|
|
10
|
+
|
|
11
|
+
@classmethod
|
|
12
|
+
def initialize(cls, engine:Engine):
|
|
13
|
+
"""Creates the database tables if they do not exist."""
|
|
14
|
+
cls.metadata.create_all(engine)
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
from sqlalchemy import
|
|
2
|
-
from sqlalchemy.
|
|
3
|
-
from sqlalchemy.orm import declarative_base, declared_attr
|
|
1
|
+
from sqlalchemy import Column, Integer, UUID, TIMESTAMP, Enum, func
|
|
2
|
+
from sqlalchemy.orm import declared_attr
|
|
4
3
|
from uuid import uuid4
|
|
5
4
|
from maleo_foundation.enums import BaseEnums
|
|
6
5
|
from maleo_foundation.utils.formatter.case import CaseFormatter
|
|
7
6
|
|
|
8
|
-
class
|
|
9
|
-
__abstract__ = True
|
|
10
|
-
|
|
7
|
+
class BaseTable:
|
|
11
8
|
@declared_attr
|
|
12
9
|
def __tablename__(cls) -> str:
|
|
13
10
|
return CaseFormatter.to_snake_case(cls.__name__)
|
|
@@ -27,15 +24,4 @@ class BaseMixin:
|
|
|
27
24
|
activated_at = Column(TIMESTAMP(timezone=True), server_default=func.now(), nullable=False)
|
|
28
25
|
|
|
29
26
|
#* Statuses
|
|
30
|
-
status = Column(Enum(BaseEnums.StatusType, name="statustype"), default=BaseEnums.StatusType.ACTIVE, nullable=False)
|
|
31
|
-
|
|
32
|
-
class DatabaseManager:
|
|
33
|
-
Base:DeclarativeMeta = declarative_base() #* Correct way to define a declarative base
|
|
34
|
-
|
|
35
|
-
#* Explicitly define the type of metadata
|
|
36
|
-
metadata:MetaData = Base.metadata
|
|
37
|
-
|
|
38
|
-
@classmethod
|
|
39
|
-
def initialize(cls, engine:Engine):
|
|
40
|
-
"""Creates the database tables if they do not exist."""
|
|
41
|
-
cls.metadata.create_all(engine)
|
|
27
|
+
status = Column(Enum(BaseEnums.StatusType, name="statustype"), default=BaseEnums.StatusType.ACTIVE, nullable=False)
|
|
@@ -13,10 +13,11 @@ maleo_foundation/clients/google/cloud/secret.py,sha256=cFewA-EYsAaEfxc2G2XGzwHre
|
|
|
13
13
|
maleo_foundation/clients/google/cloud/storage.py,sha256=y_HAsbcGSnu5sxZPxaQWFWvOlF3vEcqkej2834OgAS0,2617
|
|
14
14
|
maleo_foundation/clients/utils/__init__.py,sha256=hChEGABHH4tOFxPRcpxmlhkM9PgF18M7wXapH88hpu4,131
|
|
15
15
|
maleo_foundation/clients/utils/logger.py,sha256=QhxljzrvNY_gXAHCqaOUJJAgwvvcE9v3IQK6AWYxzM4,1144
|
|
16
|
-
maleo_foundation/db/__init__.py,sha256=
|
|
17
|
-
maleo_foundation/db/database.py,sha256=wrgNUCyScSbkBngaYjckZaePRlw84Z_srlXPsVn4yto,1652
|
|
16
|
+
maleo_foundation/db/__init__.py,sha256=fmvhCz4_siHfyKJujcUakKDKmuLxMhxn2w5tmfQwfcM,135
|
|
18
17
|
maleo_foundation/db/engine.py,sha256=kw2SMMiWy5KARquh4TLk7v6HwlHW97lUIUvqdFbhNxk,1600
|
|
18
|
+
maleo_foundation/db/manager.py,sha256=czs-6czNvKHZ7zWRX1nPpKJcdsadyX8R2DnZlA_6mlk,500
|
|
19
19
|
maleo_foundation/db/session.py,sha256=tI13DJ6rLo8FOpSIFZrmD4dbuxY_c0RTjwEGb76ZOo0,2681
|
|
20
|
+
maleo_foundation/db/table.py,sha256=z17ylPJNCE1nYYwIMaSXH1RG2YY-xWB3k5l0JcGuNWw,1174
|
|
20
21
|
maleo_foundation/expanded_types/__init__.py,sha256=RohoIQCiMvo2g6Jacq2dlqNXg3WLmRc-TD8nvMsyDKs,275
|
|
21
22
|
maleo_foundation/expanded_types/client.py,sha256=To0kRXp3QTmuSu5rWKaCiTsMK9qkYiyYKYbHfw-y1fY,2396
|
|
22
23
|
maleo_foundation/expanded_types/query.py,sha256=0yUG-JIVsanzB7KAkrRz_OsrhP6J0bRqD9Q3l3atQnk,2384
|
|
@@ -52,7 +53,7 @@ maleo_foundation/utils/logger.py,sha256=978P57JOhGR-WIu7xdPXBIwd3JrfLLA8WerVzxhE
|
|
|
52
53
|
maleo_foundation/utils/query.py,sha256=ODQ3adOYQNj5E2cRW9ytbjBz56nEDcnfq8mQ6YZbCCM,4375
|
|
53
54
|
maleo_foundation/utils/formatter/__init__.py,sha256=iKf5YCbEdg1qKnFHyKqqcQbqAqEeRUf8mhI3v3dQoj8,78
|
|
54
55
|
maleo_foundation/utils/formatter/case.py,sha256=TmvvlfzGdC_omMTB5vAa40TZBxQ3hnr-SYeo0M52Rlg,1352
|
|
55
|
-
maleo_foundation-0.0.
|
|
56
|
-
maleo_foundation-0.0.
|
|
57
|
-
maleo_foundation-0.0.
|
|
58
|
-
maleo_foundation-0.0.
|
|
56
|
+
maleo_foundation-0.0.64.dist-info/METADATA,sha256=DZP4C4iuL5QIQWEMhw12VuOv8Az0mr5XvIeQ1y3_8Q8,3160
|
|
57
|
+
maleo_foundation-0.0.64.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
|
|
58
|
+
maleo_foundation-0.0.64.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
|
|
59
|
+
maleo_foundation-0.0.64.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|