3tears-datasources 0.14.0__py3-none-any.whl
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.
- 3tears_datasources-0.14.0.dist-info/METADATA +105 -0
- 3tears_datasources-0.14.0.dist-info/RECORD +22 -0
- 3tears_datasources-0.14.0.dist-info/WHEEL +4 -0
- 3tears_datasources-0.14.0.dist-info/licenses/LICENSE +21 -0
- threetears/datasources/__init__.py +119 -0
- threetears/datasources/collections.py +1176 -0
- threetears/datasources/config.py +662 -0
- threetears/datasources/drivers/__init__.py +38 -0
- threetears/datasources/drivers/_sync_bridge.py +176 -0
- threetears/datasources/drivers/_util.py +232 -0
- threetears/datasources/drivers/asyncpg_driver.py +738 -0
- threetears/datasources/drivers/base.py +721 -0
- threetears/datasources/drivers/bigquery_driver.py +278 -0
- threetears/datasources/drivers/factory.py +128 -0
- threetears/datasources/drivers/redshift_driver.py +1605 -0
- threetears/datasources/drivers/snowflake_driver.py +241 -0
- threetears/datasources/entities.py +275 -0
- threetears/datasources/introspection.py +220 -0
- threetears/datasources/namespace.py +55 -0
- threetears/datasources/py.typed +0 -0
- threetears/datasources/schema_priming.py +165 -0
- threetears/datasources/secrets.py +30 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: 3tears-datasources
|
|
3
|
+
Version: 0.14.0
|
|
4
|
+
Summary: datasource entities, collections, namespace helpers, agent-yaml config model + driver abstraction for postgres/redshift/snowflake/bigquery backends
|
|
5
|
+
Project-URL: Repository, https://github.com/pacepace/3tears
|
|
6
|
+
Project-URL: Documentation, https://github.com/pacepace/3tears/tree/develop/packages/datasources
|
|
7
|
+
Author: pace
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Framework :: AsyncIO
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
15
|
+
Classifier: Topic :: Database
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
17
|
+
Classifier: Typing :: Typed
|
|
18
|
+
Requires-Python: >=3.14
|
|
19
|
+
Requires-Dist: 3tears-observe
|
|
20
|
+
Requires-Dist: 3tears<1.0,>=0.9.1
|
|
21
|
+
Requires-Dist: asyncpg>=0.29
|
|
22
|
+
Requires-Dist: pydantic>=2.0
|
|
23
|
+
Provides-Extra: bigquery
|
|
24
|
+
Requires-Dist: google-cloud-bigquery>=3.0; extra == 'bigquery'
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: mypy>=1.8; extra == 'dev'
|
|
27
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
28
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
29
|
+
Requires-Dist: ruff>=0.15.18; extra == 'dev'
|
|
30
|
+
Provides-Extra: redshift
|
|
31
|
+
Requires-Dist: redshift-connector>=2.1; extra == 'redshift'
|
|
32
|
+
Provides-Extra: snowflake
|
|
33
|
+
Requires-Dist: snowflake-connector-python>=3.0; extra == 'snowflake'
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
# 3tears-datasources
|
|
37
|
+
|
|
38
|
+
Datasource entities, three-tier collections, namespace helpers, the
|
|
39
|
+
agent-yaml-facing `DatasourceConfig`, and the `Driver` abstraction
|
|
40
|
+
(plus concrete asyncpg + Redshift drivers) for the 3tears platform.
|
|
41
|
+
|
|
42
|
+
This is the single source of truth for "what is a datasource" across
|
|
43
|
+
every 3tears consumer.
|
|
44
|
+
|
|
45
|
+
## Public surface
|
|
46
|
+
|
|
47
|
+
Imported via `from threetears.datasources import …`:
|
|
48
|
+
|
|
49
|
+
- **entities** -- `DataSourceEntity`, `DataSourceTableEntity`,
|
|
50
|
+
`DataSourceColumnEntity`, `DataSourceRelationEntity`,
|
|
51
|
+
`TableTemplateEntity` + the `DataSourceType`,
|
|
52
|
+
`DataSourceAccessMode`, `DataSourceStatus` enums.
|
|
53
|
+
- **collections** -- `DataSourceCollection`,
|
|
54
|
+
`DataSourceTableCollection`, `DataSourceColumnCollection`,
|
|
55
|
+
`DataSourceRelationCollection`, `TableTemplateCollection`
|
|
56
|
+
(three-tier `SchemaBackedCollection` / `BaseCollection` subclasses
|
|
57
|
+
with L1/L2/L3 caching + `_publish_invalidation` on save).
|
|
58
|
+
- **namespace** -- `DATASOURCE_NAMESPACE_TYPE`,
|
|
59
|
+
`datasource_namespace_id(uuid) -> uuid`,
|
|
60
|
+
`datasource_namespace_name(name) -> str`.
|
|
61
|
+
- **config** -- `DatasourceConfig` (the agent-yaml-facing model the
|
|
62
|
+
SDK validates against) plus the per-driver `ConnectionConfig`
|
|
63
|
+
discriminated union.
|
|
64
|
+
|
|
65
|
+
## Drivers
|
|
66
|
+
|
|
67
|
+
The `Driver` ABC + `create_driver(config, *, hub_l3_pool=None)` factory
|
|
68
|
+
are the entry point. Concrete drivers are accessed via the
|
|
69
|
+
factory, NOT imported directly:
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from threetears.datasources.drivers import create_driver
|
|
73
|
+
driver = create_driver(config.connection_config)
|
|
74
|
+
try:
|
|
75
|
+
rows = await driver.fetch("SELECT * FROM customers WHERE id = $1", customer_id)
|
|
76
|
+
finally:
|
|
77
|
+
await driver.close()
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Driver implementations live behind extras keys:
|
|
81
|
+
|
|
82
|
+
- `pip install '3tears-datasources[redshift]'` for `RedshiftDriver`
|
|
83
|
+
- `pip install '3tears-datasources[snowflake]'` for `SnowflakeDriver`
|
|
84
|
+
(stub today; full impl tracked separately)
|
|
85
|
+
- `pip install '3tears-datasources[bigquery]'` for `BigQueryDriver`
|
|
86
|
+
(stub today; full impl tracked separately)
|
|
87
|
+
|
|
88
|
+
Postgres / Yugabyte / agent_internal coverage uses `asyncpg` which is
|
|
89
|
+
a hard dep (no extras key required).
|
|
90
|
+
|
|
91
|
+
See `IMPLEMENTING_DRIVERS.md` for the contract every new driver must
|
|
92
|
+
satisfy.
|
|
93
|
+
|
|
94
|
+
## Versioning policy
|
|
95
|
+
|
|
96
|
+
`3tears-datasources` versions in **lockstep** with the rest of the
|
|
97
|
+
3tears monorepo: every package shares one version, which tracks the
|
|
98
|
+
framework git tag (`v0.9.1` at time of writing). All packages move
|
|
99
|
+
together.
|
|
100
|
+
|
|
101
|
+
The `pyproject.toml` depends on 3tears core via a compatible-release
|
|
102
|
+
range (`3tears>=0.9.1,<1.0`); because the monorepo bumps together, any
|
|
103
|
+
matching `0.9.x` core satisfies it.
|
|
104
|
+
|
|
105
|
+
See `CHANGELOG.md` for the full version history.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
threetears/datasources/__init__.py,sha256=sGWryTHfswlQSVt7hDoJaz3cAl7oaZuGUbchw0K6Pkk,4159
|
|
2
|
+
threetears/datasources/collections.py,sha256=EzXGJKFGWKdaR3raiTVmth4JOl8j5ryZRrKXx_D4cc4,44096
|
|
3
|
+
threetears/datasources/config.py,sha256=jKgxvJzkGdvXe1_AtmA-UVS-xVZ43SjMOSpsu0073tM,28616
|
|
4
|
+
threetears/datasources/entities.py,sha256=leRa6oyScUrOIl703r8yY3_JlGC1l5RKRuKwuChCEak,10222
|
|
5
|
+
threetears/datasources/introspection.py,sha256=dMacEtranLKQXclMskk8BZ5qVD8kU8BScpXcVNNHrw4,8637
|
|
6
|
+
threetears/datasources/namespace.py,sha256=GBFZQeYwDVNvZFu8ZohFRmhxtBSLBUvi5FNl4HfCGOY,2005
|
|
7
|
+
threetears/datasources/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
threetears/datasources/schema_priming.py,sha256=IXkXju7hDp2ixbHMzXoRnKeghhCkp70WdbK5ra9KEDo,7843
|
|
9
|
+
threetears/datasources/secrets.py,sha256=EwydMcy8O-LoyZjEmdpyCgnHrc_cHKP57qZIuQ8fMak,988
|
|
10
|
+
threetears/datasources/drivers/__init__.py,sha256=twb0YmrzzzCqwj8CuuGIr0uZjiCPieg90Iqq0wWd_dk,1510
|
|
11
|
+
threetears/datasources/drivers/_sync_bridge.py,sha256=EyVQzexWgINt9K9Gn9Ry4k8Rh1WqCcvLlB7wCm7I18A,6581
|
|
12
|
+
threetears/datasources/drivers/_util.py,sha256=TlYtT4lYIwLBK9iq3JHdRjU9XRTuHgzE2NubXdg8CRE,8889
|
|
13
|
+
threetears/datasources/drivers/asyncpg_driver.py,sha256=Ulh0b9ZRACOIJSOQ8I9Iz1B_zJz5gj8qOZukauzA_JQ,31991
|
|
14
|
+
threetears/datasources/drivers/base.py,sha256=PSQ1nU7W6X_xgtuYO-nRQOpbLxZ_QBtDzd7_-k4fGSY,30542
|
|
15
|
+
threetears/datasources/drivers/bigquery_driver.py,sha256=2OizvNMdCjdFuPKF3U4QdQskmsvvtYVdilVGKT1RNOg,12607
|
|
16
|
+
threetears/datasources/drivers/factory.py,sha256=VZ4fkRVmcqzXKbsg3MN6F_6a8WcYmDD_FkQJJyHBLXQ,5658
|
|
17
|
+
threetears/datasources/drivers/redshift_driver.py,sha256=jPan3ACg5KEv4lhelIe2haYMI4Q_5WoObwzYTylS8KE,70224
|
|
18
|
+
threetears/datasources/drivers/snowflake_driver.py,sha256=CIUApElMkSxAZQAN9Huvy6SPdF3ibkyCcKG-JH5G2mo,10944
|
|
19
|
+
3tears_datasources-0.14.0.dist-info/METADATA,sha256=GiLb5zVTlTQlcr7KSizVA6K9I4TUi_80cj87qAbEOzs,4038
|
|
20
|
+
3tears_datasources-0.14.0.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
|
|
21
|
+
3tears_datasources-0.14.0.dist-info/licenses/LICENSE,sha256=7GWEoEOcFJenZLt4LDzqH2K7QLxo_2m8rzG7Vv8VGXo,1066
|
|
22
|
+
3tears_datasources-0.14.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mark Pace
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"""datasource entities, collections, namespace helpers, and agent.yaml config model.
|
|
2
|
+
|
|
3
|
+
this package is the single source of truth for datasource primitives
|
|
4
|
+
across every 3tears consumer (Hub, agent pods, future products). the
|
|
5
|
+
``Driver`` abstraction + per-backend driver implementations land in
|
|
6
|
+
``threetears.datasources.drivers`` (datasource-task-09 through 12);
|
|
7
|
+
drivers are accessed via the
|
|
8
|
+
:func:`threetears.datasources.drivers.create_driver` factory and are
|
|
9
|
+
NOT re-exported from this top-level ``__all__`` -- the package root
|
|
10
|
+
stays free of backend-library imports (asyncpg, redshift_connector,
|
|
11
|
+
etc.) so a consumer that never uses a given driver doesn't pay the
|
|
12
|
+
import cost.
|
|
13
|
+
|
|
14
|
+
public surface (per shard DS-07-10):
|
|
15
|
+
|
|
16
|
+
- entities -- :class:`DataSourceEntity`, :class:`DataSourceTableEntity`,
|
|
17
|
+
:class:`DataSourceColumnEntity`, :class:`DataSourceRelationEntity`,
|
|
18
|
+
:class:`TableTemplateEntity` + lifecycle enums (:class:`DataSourceType`,
|
|
19
|
+
:class:`DataSourceAccessMode`, :class:`DataSourceStatus`)
|
|
20
|
+
- collections -- :class:`DataSourceCollection`,
|
|
21
|
+
:class:`DataSourceTableCollection`, :class:`DataSourceColumnCollection`,
|
|
22
|
+
:class:`DataSourceRelationCollection`, :class:`TableTemplateCollection`
|
|
23
|
+
- namespace helpers -- :data:`DATASOURCE_NAMESPACE_TYPE`,
|
|
24
|
+
:func:`datasource_namespace_id`, :func:`datasource_namespace_name`
|
|
25
|
+
- agent.yaml-facing config -- :class:`DatasourceConfig`
|
|
26
|
+
|
|
27
|
+
driver implementations live in the ``drivers`` subpackage and are
|
|
28
|
+
imported lazily via the factory:
|
|
29
|
+
|
|
30
|
+
from threetears.datasources.drivers import create_driver, Driver
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
from __future__ import annotations
|
|
34
|
+
|
|
35
|
+
# Version is derived from package metadata so pyproject.toml stays the
|
|
36
|
+
# single source of truth -- a release that bumps the version in
|
|
37
|
+
# pyproject without updating ``__init__.py`` can't drift the runtime
|
|
38
|
+
# ``__version__``.
|
|
39
|
+
from importlib.metadata import PackageNotFoundError as _PackageNotFoundError
|
|
40
|
+
from importlib.metadata import version as _version
|
|
41
|
+
|
|
42
|
+
try:
|
|
43
|
+
__version__ = _version("3tears-datasources")
|
|
44
|
+
except _PackageNotFoundError: # pragma: no cover - dev fallback
|
|
45
|
+
__version__ = "unknown"
|
|
46
|
+
|
|
47
|
+
from threetears.datasources.collections import (
|
|
48
|
+
DataSourceCollection,
|
|
49
|
+
DataSourceColumnCollection,
|
|
50
|
+
DataSourceRelationCollection,
|
|
51
|
+
DataSourceSchemaDigestCollection,
|
|
52
|
+
DataSourceTableCollection,
|
|
53
|
+
TableTemplateCollection,
|
|
54
|
+
)
|
|
55
|
+
from threetears.datasources.config import (
|
|
56
|
+
AgentInternalConnectionConfig,
|
|
57
|
+
BigQueryConnectionConfig,
|
|
58
|
+
ConnectionConfig,
|
|
59
|
+
DatasourceConfig,
|
|
60
|
+
PostgresConnectionConfig,
|
|
61
|
+
RedshiftConnectionConfig,
|
|
62
|
+
SnowflakeConnectionConfig,
|
|
63
|
+
YugabyteConnectionConfig,
|
|
64
|
+
)
|
|
65
|
+
from threetears.datasources.entities import (
|
|
66
|
+
DataSourceAccessMode,
|
|
67
|
+
DataSourceColumnEntity,
|
|
68
|
+
DataSourceEntity,
|
|
69
|
+
DataSourceRelationEntity,
|
|
70
|
+
DataSourceSchemaDigestEntity,
|
|
71
|
+
DataSourceStatus,
|
|
72
|
+
DataSourceTableEntity,
|
|
73
|
+
DataSourceType,
|
|
74
|
+
TableTemplateEntity,
|
|
75
|
+
)
|
|
76
|
+
from threetears.datasources.introspection import (
|
|
77
|
+
IntrospectionDiff,
|
|
78
|
+
compute_column_hash,
|
|
79
|
+
compute_introspection_diff,
|
|
80
|
+
)
|
|
81
|
+
from threetears.datasources.namespace import (
|
|
82
|
+
DATASOURCE_NAMESPACE_TYPE,
|
|
83
|
+
datasource_namespace_id,
|
|
84
|
+
datasource_namespace_name,
|
|
85
|
+
)
|
|
86
|
+
from threetears.datasources.schema_priming import SchemaPrimingIntegration
|
|
87
|
+
|
|
88
|
+
__all__ = [
|
|
89
|
+
"DATASOURCE_NAMESPACE_TYPE",
|
|
90
|
+
"AgentInternalConnectionConfig",
|
|
91
|
+
"BigQueryConnectionConfig",
|
|
92
|
+
"ConnectionConfig",
|
|
93
|
+
"DataSourceAccessMode",
|
|
94
|
+
"DataSourceCollection",
|
|
95
|
+
"DataSourceColumnCollection",
|
|
96
|
+
"DataSourceColumnEntity",
|
|
97
|
+
"DataSourceEntity",
|
|
98
|
+
"DataSourceRelationCollection",
|
|
99
|
+
"DataSourceRelationEntity",
|
|
100
|
+
"DataSourceSchemaDigestCollection",
|
|
101
|
+
"DataSourceSchemaDigestEntity",
|
|
102
|
+
"DataSourceStatus",
|
|
103
|
+
"DataSourceTableCollection",
|
|
104
|
+
"DataSourceTableEntity",
|
|
105
|
+
"DataSourceType",
|
|
106
|
+
"DatasourceConfig",
|
|
107
|
+
"IntrospectionDiff",
|
|
108
|
+
"PostgresConnectionConfig",
|
|
109
|
+
"RedshiftConnectionConfig",
|
|
110
|
+
"SchemaPrimingIntegration",
|
|
111
|
+
"SnowflakeConnectionConfig",
|
|
112
|
+
"TableTemplateCollection",
|
|
113
|
+
"TableTemplateEntity",
|
|
114
|
+
"YugabyteConnectionConfig",
|
|
115
|
+
"compute_column_hash",
|
|
116
|
+
"compute_introspection_diff",
|
|
117
|
+
"datasource_namespace_id",
|
|
118
|
+
"datasource_namespace_name",
|
|
119
|
+
]
|