pjdev-sqlmodel 0.0.1a3__tar.gz → 0.0.1a4__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,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pjdev-sqlmodel
3
- Version: 0.0.1a3
3
+ Version: 0.0.1a4
4
4
  Project-URL: Documentation, https://gitlab.purplejay.net/keystone/python/-/tree/main/pjdev-sqlmodel#readme
5
5
  Project-URL: Issues, https://gitlab.purplejay.net/keystone/python/issues
6
6
  Project-URL: Source, https://gitlab.purplejay.net/keystone/python
@@ -1,4 +1,4 @@
1
1
  # SPDX-FileCopyrightText: 2024-present Chris O'Neill <chris@purplejay.io>
2
2
  #
3
3
  # SPDX-License-Identifier: MIT
4
- __version__ = "0.0.1a3"
4
+ __version__ = "0.0.1a4"
@@ -19,11 +19,6 @@ class DBContext:
19
19
  __ctx = DBContext()
20
20
 
21
21
 
22
- def init(settings: SqlModelSettings) -> None:
23
- database_url = f"sqlite:///{settings.data_path}"
24
- __ctx.engine = create_engine(database_url, echo=False, poolclass=NullPool)
25
-
26
-
27
22
  def initialize_engine(
28
23
  settings: SqlModelSettings,
29
24
  tables: List[Type[SQLModel]],
@@ -32,7 +27,7 @@ def initialize_engine(
32
27
  if len(tables) == 0:
33
28
  raise ValueError("Must specify at least one table")
34
29
 
35
- database_url = f"sqlite:///{settings.data_path}"
30
+ database_url = f"sqlite:///{settings.data_path}/{settings.sqlite_filename}"
36
31
 
37
32
  engine = create_engine(database_url, echo=echo, poolclass=NullPool)
38
33
 
@@ -8,6 +8,7 @@ from pydantic_settings import BaseSettings, SettingsConfigDict
8
8
 
9
9
  class SqlModelSettings(BaseSettings):
10
10
  data_path: Path
11
+ sqlite_filename: str = "data.db"
11
12
 
12
13
  model_config = SettingsConfigDict(
13
14
  case_sensitive=False, extra="ignore", env_prefix="PJDEV_"