pjdev-sqlmodel 0.0.1a4__tar.gz → 3.4.2__tar.gz
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.
- {pjdev_sqlmodel-0.0.1a4 → pjdev_sqlmodel-3.4.2}/PKG-INFO +3 -3
- {pjdev_sqlmodel-0.0.1a4 → pjdev_sqlmodel-3.4.2}/pyproject.toml +2 -2
- pjdev_sqlmodel-0.0.1a4/tests/__init__.py → pjdev_sqlmodel-3.4.2/src/pjdev_sqlmodel/__about__.py +1 -0
- pjdev_sqlmodel-0.0.1a4/src/pjdev_sqlmodel/__about__.py → pjdev_sqlmodel-3.4.2/src/pjdev_sqlmodel/__init__.py +4 -1
- pjdev_sqlmodel-3.4.2/src/pjdev_sqlmodel/db_models.py +12 -0
- {pjdev_sqlmodel-0.0.1a4 → pjdev_sqlmodel-3.4.2}/src/pjdev_sqlmodel/service.py +4 -3
- {pjdev_sqlmodel-0.0.1a4 → pjdev_sqlmodel-3.4.2}/src/pjdev_sqlmodel/utilities.py +2 -2
- {pjdev_sqlmodel-0.0.1a4 → pjdev_sqlmodel-3.4.2}/.gitignore +0 -0
- {pjdev_sqlmodel-0.0.1a4 → pjdev_sqlmodel-3.4.2}/LICENSE.txt +0 -0
- {pjdev_sqlmodel-0.0.1a4 → pjdev_sqlmodel-3.4.2}/README.md +0 -0
- {pjdev_sqlmodel-0.0.1a4 → pjdev_sqlmodel-3.4.2}/src/pjdev_sqlmodel/settings.py +0 -0
- {pjdev_sqlmodel-0.0.1a4/src/pjdev_sqlmodel → pjdev_sqlmodel-3.4.2/tests}/__init__.py +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: pjdev-sqlmodel
|
|
3
|
-
Version:
|
|
4
|
-
Project-URL: Documentation, https://gitlab.purplejay.net/keystone/python
|
|
3
|
+
Version: 3.4.2
|
|
4
|
+
Project-URL: Documentation, https://gitlab.purplejay.net/keystone/python
|
|
5
5
|
Project-URL: Issues, https://gitlab.purplejay.net/keystone/python/issues
|
|
6
6
|
Project-URL: Source, https://gitlab.purplejay.net/keystone/python
|
|
7
|
-
Author-email: Purple Jay LLC <
|
|
7
|
+
Author-email: Purple Jay LLC <apps+keystone-python-221-issue-@purplejay.io>
|
|
8
8
|
License-Expression: MIT
|
|
9
9
|
License-File: LICENSE.txt
|
|
10
10
|
Classifier: Development Status :: 4 - Beta
|
|
@@ -11,7 +11,7 @@ requires-python = ">=3.12"
|
|
|
11
11
|
license = "MIT"
|
|
12
12
|
keywords = []
|
|
13
13
|
authors = [
|
|
14
|
-
{ name = "Purple Jay LLC", email = "
|
|
14
|
+
{ name = "Purple Jay LLC", email = "apps+keystone-python-221-issue-@purplejay.io" },
|
|
15
15
|
]
|
|
16
16
|
classifiers = [
|
|
17
17
|
"Development Status :: 4 - Beta",
|
|
@@ -29,7 +29,7 @@ dependencies = [
|
|
|
29
29
|
]
|
|
30
30
|
|
|
31
31
|
[project.urls]
|
|
32
|
-
Documentation = "https://gitlab.purplejay.net/keystone/python
|
|
32
|
+
Documentation = "https://gitlab.purplejay.net/keystone/python"
|
|
33
33
|
Issues = "https://gitlab.purplejay.net/keystone/python/issues"
|
|
34
34
|
Source = "https://gitlab.purplejay.net/keystone/python"
|
|
35
35
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from pydantic import ConfigDict
|
|
4
|
+
from sqlmodel import SQLModel, Field as SqlField
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ModelBase(SQLModel):
|
|
8
|
+
model_config = ConfigDict(extra="ignore", populate_by_name=True)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class TableModel(ModelBase):
|
|
12
|
+
row_id: Optional[int] = SqlField(default=None, primary_key=True)
|
|
@@ -6,8 +6,9 @@ from typing import (
|
|
|
6
6
|
)
|
|
7
7
|
|
|
8
8
|
from sqlalchemy import Engine, NullPool
|
|
9
|
-
from sqlmodel import
|
|
9
|
+
from sqlmodel import create_engine, Session as SQLModelSession
|
|
10
10
|
|
|
11
|
+
from pjdev_sqlmodel.db_models import ModelBase
|
|
11
12
|
from pjdev_sqlmodel.settings import SqlModelSettings
|
|
12
13
|
|
|
13
14
|
|
|
@@ -21,7 +22,7 @@ __ctx = DBContext()
|
|
|
21
22
|
|
|
22
23
|
def initialize_engine(
|
|
23
24
|
settings: SqlModelSettings,
|
|
24
|
-
tables: List[Type[
|
|
25
|
+
tables: List[Type[ModelBase]],
|
|
25
26
|
echo: bool = False,
|
|
26
27
|
) -> Engine:
|
|
27
28
|
if len(tables) == 0:
|
|
@@ -37,7 +38,7 @@ def initialize_engine(
|
|
|
37
38
|
return engine
|
|
38
39
|
|
|
39
40
|
|
|
40
|
-
def configure_single_context(settings: SqlModelSettings, tables: List[Type[
|
|
41
|
+
def configure_single_context(settings: SqlModelSettings, tables: List[Type[ModelBase]]):
|
|
41
42
|
__ctx.engine = initialize_engine(settings, tables)
|
|
42
43
|
|
|
43
44
|
|
|
@@ -4,14 +4,14 @@ from pathlib import Path
|
|
|
4
4
|
from typing import Type, TypeVar, List, Optional, Tuple, Dict
|
|
5
5
|
|
|
6
6
|
from pydantic import ValidationError, BaseModel
|
|
7
|
-
from sqlmodel import SQLModel
|
|
8
7
|
import pandas as pd
|
|
9
8
|
from openpyxl.reader.excel import load_workbook
|
|
10
9
|
from loguru import logger
|
|
11
10
|
|
|
11
|
+
from pjdev_sqlmodel.db_models import ModelBase
|
|
12
12
|
from pjdev_sqlmodel.service import session_context
|
|
13
13
|
|
|
14
|
-
T = TypeVar("T", bound=
|
|
14
|
+
T = TypeVar("T", bound=ModelBase)
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
def get_files_in_directory(directory: Path) -> List[Path]:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|