python-glowplug 0.2.5__tar.gz → 0.3.1__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.
- {python_glowplug-0.2.5 → python_glowplug-0.3.1}/PKG-INFO +2 -1
- {python_glowplug-0.2.5 → python_glowplug-0.3.1}/pyproject.toml +2 -1
- python_glowplug-0.3.1/src/glowplug/__init__.py +16 -0
- python_glowplug-0.3.1/src/glowplug/config/__init__.py +60 -0
- python_glowplug-0.3.1/src/glowplug/config/__pycache__/__init__.cpython-311.pyc +0 -0
- python_glowplug-0.3.1/src/glowplug/driver/__init__.py +0 -0
- python_glowplug-0.3.1/src/glowplug/driver/__pycache__/__init__.cpython-311.pyc +0 -0
- python_glowplug-0.3.1/src/glowplug/driver/__pycache__/base.cpython-311.pyc +0 -0
- python_glowplug-0.3.1/src/glowplug/driver/__pycache__/mssql.cpython-311.pyc +0 -0
- python_glowplug-0.3.1/src/glowplug/driver/__pycache__/pg.cpython-311.pyc +0 -0
- python_glowplug-0.3.1/src/glowplug/driver/__pycache__/sqlite.cpython-311.pyc +0 -0
- python_glowplug-0.2.5/src/glowplug/__init__.py +0 -6
- {python_glowplug-0.2.5 → python_glowplug-0.3.1}/LICENSE +0 -0
- {python_glowplug-0.2.5 → python_glowplug-0.3.1}/README.md +0 -0
- {python_glowplug-0.2.5/src/glowplug → python_glowplug-0.3.1/src/glowplug/driver}/base.py +0 -0
- {python_glowplug-0.2.5/src/glowplug → python_glowplug-0.3.1/src/glowplug/driver}/mssql.py +0 -0
- {python_glowplug-0.2.5/src/glowplug → python_glowplug-0.3.1/src/glowplug/driver}/pg.py +0 -0
- {python_glowplug-0.2.5/src/glowplug → python_glowplug-0.3.1/src/glowplug/driver}/sqlite.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-glowplug
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.1
|
|
4
4
|
Summary:
|
|
5
5
|
Home-page: https://github.com/jnu/python-glowplug
|
|
6
6
|
License: MIT
|
|
@@ -14,6 +14,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.12
|
|
16
16
|
Requires-Dist: alembic (>=1.5,<2.0)
|
|
17
|
+
Requires-Dist: pydantic (>=2,<3)
|
|
17
18
|
Requires-Dist: sqlalchemy (>=2,<3)
|
|
18
19
|
Project-URL: Repository, https://github.com/jnu/python-glowplug
|
|
19
20
|
Description-Content-Type: text/markdown
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "python-glowplug"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.3.1"
|
|
4
4
|
description = ""
|
|
5
5
|
authors = ["Joe Nudell <jnudell@hks.harvard.edu>"]
|
|
6
6
|
readme = "README.md"
|
|
@@ -14,6 +14,7 @@ packages = [
|
|
|
14
14
|
python = "^3.9"
|
|
15
15
|
sqlalchemy = "^2"
|
|
16
16
|
alembic = "^1.5"
|
|
17
|
+
pydantic = "^2"
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
[tool.poetry.group.dev.dependencies]
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from .driver.base import DbDriver
|
|
2
|
+
from .driver.pg import PostgresDriver
|
|
3
|
+
from .driver.sqlite import SqliteDriver
|
|
4
|
+
from .driver.mssql import MsSqlDriver
|
|
5
|
+
|
|
6
|
+
from .config import PostgresSettings, MsSqlSettings, SqliteSettings
|
|
7
|
+
|
|
8
|
+
__all__ = [
|
|
9
|
+
"DbDriver",
|
|
10
|
+
"PostgresDriver",
|
|
11
|
+
"SqliteDriver",
|
|
12
|
+
"MsSqlDriver",
|
|
13
|
+
"PostgresSettings",
|
|
14
|
+
"MsSqlSettings",
|
|
15
|
+
"SqliteSettings",
|
|
16
|
+
]
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
from functools import cached_property
|
|
2
|
+
from typing import Literal
|
|
3
|
+
|
|
4
|
+
from pydantic import BaseModel
|
|
5
|
+
|
|
6
|
+
from ..driver.mssql import MsSqlDriver
|
|
7
|
+
from ..driver.pg import PostgresDriver
|
|
8
|
+
from ..driver.sqlite import SqliteDriver
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class SqliteSettings(BaseModel):
|
|
12
|
+
"""Settings for connecting to SQLite."""
|
|
13
|
+
|
|
14
|
+
engine: Literal["sqlite"]
|
|
15
|
+
path: str = ":memory:"
|
|
16
|
+
|
|
17
|
+
@cached_property
|
|
18
|
+
def driver(self) -> SqliteDriver:
|
|
19
|
+
return SqliteDriver(self.path)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class PostgresSettings(BaseModel):
|
|
23
|
+
"""Settings for connecting to Postgres."""
|
|
24
|
+
|
|
25
|
+
engine: Literal["postgres"]
|
|
26
|
+
host: str = "localhost"
|
|
27
|
+
port: int = 5432
|
|
28
|
+
user: str = "postgres"
|
|
29
|
+
password: str
|
|
30
|
+
database: str
|
|
31
|
+
maintenance_db: str | None = None
|
|
32
|
+
|
|
33
|
+
@cached_property
|
|
34
|
+
def driver(self) -> PostgresDriver:
|
|
35
|
+
url = f"{self.user}:{self.password}@{self.host}:{self.port}/{self.database}"
|
|
36
|
+
return PostgresDriver(url, maintenance_db=self.maintenance_db)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class MsSqlSettings(BaseModel):
|
|
40
|
+
"""Settings for connecting to Microsoft SQL Server."""
|
|
41
|
+
|
|
42
|
+
engine: Literal["mssql"]
|
|
43
|
+
odbc_driver: Literal["ODBC Driver 17 for SQL Server"] = (
|
|
44
|
+
"ODBC Driver 17 for SQL Server"
|
|
45
|
+
)
|
|
46
|
+
host: str = "127.0.0.1"
|
|
47
|
+
port: int = 1433
|
|
48
|
+
user: str = "sa"
|
|
49
|
+
password: str
|
|
50
|
+
database: str
|
|
51
|
+
maintenance_db: str = "master"
|
|
52
|
+
|
|
53
|
+
@cached_property
|
|
54
|
+
def driver(self):
|
|
55
|
+
odbc_driver = self.odbc_driver.replace(" ", "+")
|
|
56
|
+
path = (
|
|
57
|
+
f"{self.user}:{self.password}@{self.host}:{self.port}"
|
|
58
|
+
f"/{self.database}?driver={odbc_driver}"
|
|
59
|
+
)
|
|
60
|
+
return MsSqlDriver(path, maintenance_db=self.maintenance_db)
|
|
File without changes
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|