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.
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pjdev-sqlmodel
3
- Version: 0.0.1a4
4
- Project-URL: Documentation, https://gitlab.purplejay.net/keystone/python/-/tree/main/pjdev-sqlmodel#readme
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 <app-support@purplejay.io>
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 = "app-support@purplejay.io" },
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/-/tree/main/pjdev-sqlmodel#readme"
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
 
@@ -1,3 +1,4 @@
1
1
  # SPDX-FileCopyrightText: 2024-present Chris O'Neill <chris@purplejay.io>
2
2
  #
3
3
  # SPDX-License-Identifier: MIT
4
+ __version__ = "3.4.2"
@@ -1,4 +1,7 @@
1
1
  # SPDX-FileCopyrightText: 2024-present Chris O'Neill <chris@purplejay.io>
2
2
  #
3
3
  # SPDX-License-Identifier: MIT
4
- __version__ = "0.0.1a4"
4
+
5
+ from loguru import logger
6
+
7
+ logger.disable("pjdev_sqlmodel")
@@ -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 SQLModel, create_engine, Session as SQLModelSession
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[SQLModel]],
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[SQLModel]]):
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=SQLModel)
14
+ T = TypeVar("T", bound=ModelBase)
15
15
 
16
16
 
17
17
  def get_files_in_directory(directory: Path) -> List[Path]: