muscles-data-sqlalchemy 0.1.1__tar.gz → 0.2.0__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.
- {muscles_data_sqlalchemy-0.1.1 → muscles_data_sqlalchemy-0.2.0}/PKG-INFO +13 -11
- {muscles_data_sqlalchemy-0.1.1 → muscles_data_sqlalchemy-0.2.0}/README.md +12 -10
- {muscles_data_sqlalchemy-0.1.1 → muscles_data_sqlalchemy-0.2.0}/pyproject.toml +2 -1
- {muscles_data_sqlalchemy-0.1.1/src/muscles_data_sqlalchemy → muscles_data_sqlalchemy-0.2.0/src/muscles/data/sqlalchemy}/adapter.py +3 -3
- {muscles_data_sqlalchemy-0.1.1 → muscles_data_sqlalchemy-0.2.0}/src/muscles_data_sqlalchemy.egg-info/PKG-INFO +13 -11
- {muscles_data_sqlalchemy-0.1.1 → muscles_data_sqlalchemy-0.2.0}/src/muscles_data_sqlalchemy.egg-info/SOURCES.txt +2 -2
- muscles_data_sqlalchemy-0.2.0/src/muscles_data_sqlalchemy.egg-info/top_level.txt +1 -0
- {muscles_data_sqlalchemy-0.1.1 → muscles_data_sqlalchemy-0.2.0}/tests/test_integration.py +6 -6
- {muscles_data_sqlalchemy-0.1.1 → muscles_data_sqlalchemy-0.2.0}/tests/test_sqlalchemy_adapter.py +6 -6
- muscles_data_sqlalchemy-0.1.1/src/muscles_data_sqlalchemy.egg-info/top_level.txt +0 -1
- {muscles_data_sqlalchemy-0.1.1 → muscles_data_sqlalchemy-0.2.0}/setup.cfg +0 -0
- {muscles_data_sqlalchemy-0.1.1/src/muscles_data_sqlalchemy → muscles_data_sqlalchemy-0.2.0/src/muscles/data/sqlalchemy}/__init__.py +0 -0
- {muscles_data_sqlalchemy-0.1.1 → muscles_data_sqlalchemy-0.2.0}/src/muscles_data_sqlalchemy.egg-info/dependency_links.txt +0 -0
- {muscles_data_sqlalchemy-0.1.1 → muscles_data_sqlalchemy-0.2.0}/src/muscles_data_sqlalchemy.egg-info/requires.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: muscles-data-sqlalchemy
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: SQLAlchemy SqlResourcePort adapter for muscles-data
|
|
5
5
|
Author-email: "Denis B." <denis@butko.info>
|
|
6
6
|
Project-URL: Homepage, https://github.com/butkoden/muscles-data-sqlalchemy
|
|
@@ -31,7 +31,7 @@ owns typed ports, resource runtime and diagnostics, while this package owns the
|
|
|
31
31
|
SQLAlchemy-backed `SqlResourcePort` adapter.
|
|
32
32
|
|
|
33
33
|
Use this package when a project wants direct SQLAlchemy sessions through the
|
|
34
|
-
same data resource runtime without wiring `muscles-sql` first.
|
|
34
|
+
same data resource runtime without wiring `muscles-data-sql` first.
|
|
35
35
|
|
|
36
36
|
## Related packages
|
|
37
37
|
|
|
@@ -54,19 +54,21 @@ same data resource runtime without wiring `muscles-sql` first.
|
|
|
54
54
|
|
|
55
55
|
## Usage
|
|
56
56
|
|
|
57
|
-
Register
|
|
57
|
+
Register this adapter once in the application composition root when building
|
|
58
|
+
the shared `DataAdapterCatalog`, alongside other configured adapters:
|
|
58
59
|
|
|
59
60
|
```python
|
|
60
|
-
from muscles_data.catalog import DataAdapterCatalog
|
|
61
|
-
from muscles_data.ports import SqlResourcePort
|
|
62
|
-
from muscles_data.runtime import DataRuntime
|
|
63
|
-
from muscles_data_sqlalchemy import SqlAlchemySqlResourceFactory
|
|
64
|
-
|
|
65
|
-
catalog = DataAdapterCatalog.with_defaults()
|
|
66
61
|
catalog.register(SqlAlchemySqlResourceFactory())
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The `sql.local` resource itself is declared in the application's central
|
|
65
|
+
`data.resources` configuration shown below. A package resolves the port from
|
|
66
|
+
the existing runtime; it does not build another catalog or `DataRuntime`:
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from muscles.data.ports import SqlResourcePort
|
|
67
70
|
|
|
68
|
-
|
|
69
|
-
sql = runtime.require_port("sql.local", SqlResourcePort)
|
|
71
|
+
sql = app.resource.connect("sql.local", SqlResourcePort)
|
|
70
72
|
```
|
|
71
73
|
|
|
72
74
|
Resource config stays in the project:
|
|
@@ -7,7 +7,7 @@ owns typed ports, resource runtime and diagnostics, while this package owns the
|
|
|
7
7
|
SQLAlchemy-backed `SqlResourcePort` adapter.
|
|
8
8
|
|
|
9
9
|
Use this package when a project wants direct SQLAlchemy sessions through the
|
|
10
|
-
same data resource runtime without wiring `muscles-sql` first.
|
|
10
|
+
same data resource runtime without wiring `muscles-data-sql` first.
|
|
11
11
|
|
|
12
12
|
## Related packages
|
|
13
13
|
|
|
@@ -30,19 +30,21 @@ same data resource runtime without wiring `muscles-sql` first.
|
|
|
30
30
|
|
|
31
31
|
## Usage
|
|
32
32
|
|
|
33
|
-
Register
|
|
33
|
+
Register this adapter once in the application composition root when building
|
|
34
|
+
the shared `DataAdapterCatalog`, alongside other configured adapters:
|
|
34
35
|
|
|
35
36
|
```python
|
|
36
|
-
from muscles_data.catalog import DataAdapterCatalog
|
|
37
|
-
from muscles_data.ports import SqlResourcePort
|
|
38
|
-
from muscles_data.runtime import DataRuntime
|
|
39
|
-
from muscles_data_sqlalchemy import SqlAlchemySqlResourceFactory
|
|
40
|
-
|
|
41
|
-
catalog = DataAdapterCatalog.with_defaults()
|
|
42
37
|
catalog.register(SqlAlchemySqlResourceFactory())
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The `sql.local` resource itself is declared in the application's central
|
|
41
|
+
`data.resources` configuration shown below. A package resolves the port from
|
|
42
|
+
the existing runtime; it does not build another catalog or `DataRuntime`:
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
from muscles.data.ports import SqlResourcePort
|
|
43
46
|
|
|
44
|
-
|
|
45
|
-
sql = runtime.require_port("sql.local", SqlResourcePort)
|
|
47
|
+
sql = app.resource.connect("sql.local", SqlResourcePort)
|
|
46
48
|
```
|
|
47
49
|
|
|
48
50
|
Resource config stays in the project:
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "muscles-data-sqlalchemy"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.2.0"
|
|
8
8
|
description = "SQLAlchemy SqlResourcePort adapter for muscles-data"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -44,3 +44,4 @@ package-dir = {"" = "src"}
|
|
|
44
44
|
|
|
45
45
|
[tool.setuptools.packages.find]
|
|
46
46
|
where = ["src"]
|
|
47
|
+
include = ["muscles.data.sqlalchemy*"]
|
|
@@ -6,9 +6,9 @@ from collections.abc import Callable
|
|
|
6
6
|
from dataclasses import asdict
|
|
7
7
|
from typing import Any, Mapping
|
|
8
8
|
|
|
9
|
-
from
|
|
10
|
-
from
|
|
11
|
-
from
|
|
9
|
+
from muscles.data.config import DataResourceConfig
|
|
10
|
+
from muscles.data.errors import DataError
|
|
11
|
+
from muscles.data.models import DataCapability, HealthResult, InspectResult
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
_ENGINE_UNSET = object()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: muscles-data-sqlalchemy
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: SQLAlchemy SqlResourcePort adapter for muscles-data
|
|
5
5
|
Author-email: "Denis B." <denis@butko.info>
|
|
6
6
|
Project-URL: Homepage, https://github.com/butkoden/muscles-data-sqlalchemy
|
|
@@ -31,7 +31,7 @@ owns typed ports, resource runtime and diagnostics, while this package owns the
|
|
|
31
31
|
SQLAlchemy-backed `SqlResourcePort` adapter.
|
|
32
32
|
|
|
33
33
|
Use this package when a project wants direct SQLAlchemy sessions through the
|
|
34
|
-
same data resource runtime without wiring `muscles-sql` first.
|
|
34
|
+
same data resource runtime without wiring `muscles-data-sql` first.
|
|
35
35
|
|
|
36
36
|
## Related packages
|
|
37
37
|
|
|
@@ -54,19 +54,21 @@ same data resource runtime without wiring `muscles-sql` first.
|
|
|
54
54
|
|
|
55
55
|
## Usage
|
|
56
56
|
|
|
57
|
-
Register
|
|
57
|
+
Register this adapter once in the application composition root when building
|
|
58
|
+
the shared `DataAdapterCatalog`, alongside other configured adapters:
|
|
58
59
|
|
|
59
60
|
```python
|
|
60
|
-
from muscles_data.catalog import DataAdapterCatalog
|
|
61
|
-
from muscles_data.ports import SqlResourcePort
|
|
62
|
-
from muscles_data.runtime import DataRuntime
|
|
63
|
-
from muscles_data_sqlalchemy import SqlAlchemySqlResourceFactory
|
|
64
|
-
|
|
65
|
-
catalog = DataAdapterCatalog.with_defaults()
|
|
66
61
|
catalog.register(SqlAlchemySqlResourceFactory())
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The `sql.local` resource itself is declared in the application's central
|
|
65
|
+
`data.resources` configuration shown below. A package resolves the port from
|
|
66
|
+
the existing runtime; it does not build another catalog or `DataRuntime`:
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from muscles.data.ports import SqlResourcePort
|
|
67
70
|
|
|
68
|
-
|
|
69
|
-
sql = runtime.require_port("sql.local", SqlResourcePort)
|
|
71
|
+
sql = app.resource.connect("sql.local", SqlResourcePort)
|
|
70
72
|
```
|
|
71
73
|
|
|
72
74
|
Resource config stays in the project:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
README.md
|
|
2
2
|
pyproject.toml
|
|
3
|
-
src/
|
|
4
|
-
src/
|
|
3
|
+
src/muscles/data/sqlalchemy/__init__.py
|
|
4
|
+
src/muscles/data/sqlalchemy/adapter.py
|
|
5
5
|
src/muscles_data_sqlalchemy.egg-info/PKG-INFO
|
|
6
6
|
src/muscles_data_sqlalchemy.egg-info/SOURCES.txt
|
|
7
7
|
src/muscles_data_sqlalchemy.egg-info/dependency_links.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
muscles
|
|
@@ -5,12 +5,12 @@ from pathlib import Path
|
|
|
5
5
|
from tempfile import TemporaryDirectory
|
|
6
6
|
|
|
7
7
|
import pytest
|
|
8
|
-
from
|
|
9
|
-
from
|
|
10
|
-
from
|
|
11
|
-
from
|
|
8
|
+
from muscles.data.catalog import DataAdapterCatalog
|
|
9
|
+
from muscles.data.config import DataConfig
|
|
10
|
+
from muscles.data.ports import SqlResourcePort
|
|
11
|
+
from muscles.data.runtime import DataRuntime
|
|
12
12
|
|
|
13
|
-
from
|
|
13
|
+
from muscles.data.sqlalchemy import SqlAlchemySqlResourceFactory
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
pytestmark = [
|
|
@@ -50,7 +50,7 @@ def test_sqlalchemy_real_session_and_health_lifecycle():
|
|
|
50
50
|
assert session.execute(text("select 1")).scalar_one() == 1
|
|
51
51
|
assert sql.doctor()["status"] == "ok"
|
|
52
52
|
assert runtime.doctor()["status"] == "ok"
|
|
53
|
-
contracts = pytest.importorskip("
|
|
53
|
+
contracts = pytest.importorskip("muscles.data.contracts")
|
|
54
54
|
contract = getattr(contracts, "assert_sql_resource_contract", None)
|
|
55
55
|
if contract is not None:
|
|
56
56
|
contract(lambda: sql)
|
{muscles_data_sqlalchemy-0.1.1 → muscles_data_sqlalchemy-0.2.0}/tests/test_sqlalchemy_adapter.py
RENAMED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import pytest
|
|
4
|
-
from
|
|
5
|
-
from
|
|
6
|
-
from
|
|
7
|
-
from
|
|
8
|
-
from
|
|
4
|
+
from muscles.data.catalog import DataAdapterCatalog
|
|
5
|
+
from muscles.data.config import DataConfig
|
|
6
|
+
from muscles.data.models import DataCapability
|
|
7
|
+
from muscles.data.ports import SqlResourcePort
|
|
8
|
+
from muscles.data.runtime import DataRuntime
|
|
9
9
|
|
|
10
|
-
from
|
|
10
|
+
from muscles.data.sqlalchemy import (
|
|
11
11
|
SqlAlchemyClientMissingError,
|
|
12
12
|
SqlAlchemyConnectionError,
|
|
13
13
|
SqlAlchemySqlResourceFactory,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
muscles_data_sqlalchemy
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|