onestep-postgres 0.1.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.
- onestep_postgres-0.1.0/.gitignore +146 -0
- onestep_postgres-0.1.0/PKG-INFO +56 -0
- onestep_postgres-0.1.0/README.md +41 -0
- onestep_postgres-0.1.0/pyproject.toml +33 -0
- onestep_postgres-0.1.0/src/onestep_postgres/__init__.py +37 -0
- onestep_postgres-0.1.0/src/onestep_postgres/connector.py +465 -0
- onestep_postgres-0.1.0/src/onestep_postgres/resilience.py +64 -0
- onestep_postgres-0.1.0/src/onestep_postgres/resources.py +152 -0
- onestep_postgres-0.1.0/src/onestep_postgres/state_sqlalchemy.py +118 -0
- onestep_postgres-0.1.0/tests/integration/test_postgres_live.py +185 -0
- onestep_postgres-0.1.0/tests/test_postgres_incremental.py +221 -0
- onestep_postgres-0.1.0/tests/test_postgres_plugin.py +121 -0
- onestep_postgres-0.1.0/tests/test_postgres_runtime_contract.py +158 -0
- onestep_postgres-0.1.0/tests/test_postgres_table_queue.py +82 -0
- onestep_postgres-0.1.0/tests/test_state_sqlalchemy.py +43 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# created by virtualenv automatically
|
|
2
|
+
# Byte-compiled / optimized / DLL files
|
|
3
|
+
__pycache__/
|
|
4
|
+
*.py[cod]
|
|
5
|
+
*$py.class
|
|
6
|
+
|
|
7
|
+
# C extensions
|
|
8
|
+
*.so
|
|
9
|
+
|
|
10
|
+
# Distribution / packaging
|
|
11
|
+
.Python
|
|
12
|
+
build/
|
|
13
|
+
develop-eggs/
|
|
14
|
+
dist/
|
|
15
|
+
downloads/
|
|
16
|
+
eggs/
|
|
17
|
+
.eggs/
|
|
18
|
+
lib/
|
|
19
|
+
lib64/
|
|
20
|
+
parts/
|
|
21
|
+
sdist/
|
|
22
|
+
var/
|
|
23
|
+
wheels/
|
|
24
|
+
pip-wheel-metadata/
|
|
25
|
+
share/python-wheels/
|
|
26
|
+
*.egg-info/
|
|
27
|
+
.installed.cfg
|
|
28
|
+
*.egg
|
|
29
|
+
MANIFEST
|
|
30
|
+
|
|
31
|
+
# PyInstaller
|
|
32
|
+
# Usually these files are written by a python script from a template
|
|
33
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
34
|
+
*.manifest
|
|
35
|
+
*.spec
|
|
36
|
+
|
|
37
|
+
# Installer logs
|
|
38
|
+
pip-log.txt
|
|
39
|
+
pip-delete-this-directory.txt
|
|
40
|
+
|
|
41
|
+
# Unit test / coverage reports
|
|
42
|
+
htmlcov/
|
|
43
|
+
.tox/
|
|
44
|
+
.nox/
|
|
45
|
+
.coverage
|
|
46
|
+
.coverage.*
|
|
47
|
+
.cache
|
|
48
|
+
nosetests.xml
|
|
49
|
+
coverage.xml
|
|
50
|
+
*.cover
|
|
51
|
+
*.py,cover
|
|
52
|
+
.hypothesis/
|
|
53
|
+
.pytest_cache/
|
|
54
|
+
|
|
55
|
+
# Translations
|
|
56
|
+
*.mo
|
|
57
|
+
*.pot
|
|
58
|
+
|
|
59
|
+
# Django stuff:
|
|
60
|
+
*.log
|
|
61
|
+
local_settings.py
|
|
62
|
+
db.sqlite3
|
|
63
|
+
db.sqlite3-journal
|
|
64
|
+
|
|
65
|
+
# Flask stuff:
|
|
66
|
+
instance/
|
|
67
|
+
.webassets-cache
|
|
68
|
+
|
|
69
|
+
# Scrapy stuff:
|
|
70
|
+
.scrapy
|
|
71
|
+
|
|
72
|
+
# Sphinx documentation
|
|
73
|
+
docs/_build/
|
|
74
|
+
|
|
75
|
+
# PyBuilder
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
.python-version
|
|
87
|
+
|
|
88
|
+
# pipenv
|
|
89
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
90
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
91
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
92
|
+
# install all needed dependencies.
|
|
93
|
+
#Pipfile.lock
|
|
94
|
+
|
|
95
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
96
|
+
__pypackages__/
|
|
97
|
+
|
|
98
|
+
# Celery stuff
|
|
99
|
+
celerybeat-schedule
|
|
100
|
+
celerybeat.pid
|
|
101
|
+
|
|
102
|
+
# SageMath parsed files
|
|
103
|
+
*.sage.py
|
|
104
|
+
|
|
105
|
+
# Environments
|
|
106
|
+
.env
|
|
107
|
+
.venv
|
|
108
|
+
env/
|
|
109
|
+
venv/
|
|
110
|
+
ENV/
|
|
111
|
+
env.bak/
|
|
112
|
+
venv.bak/
|
|
113
|
+
!deploy/env/
|
|
114
|
+
!deploy/env/onestep-app.env.example
|
|
115
|
+
|
|
116
|
+
# Spyder project settings
|
|
117
|
+
.spyderproject
|
|
118
|
+
.spyproject
|
|
119
|
+
|
|
120
|
+
# Rope project settings
|
|
121
|
+
.ropeproject
|
|
122
|
+
|
|
123
|
+
# mkdocs documentation
|
|
124
|
+
/site
|
|
125
|
+
|
|
126
|
+
# mypy
|
|
127
|
+
.mypy_cache/
|
|
128
|
+
.dmypy.json
|
|
129
|
+
dmypy.json
|
|
130
|
+
|
|
131
|
+
# Pyre type checker
|
|
132
|
+
.pyre/
|
|
133
|
+
|
|
134
|
+
# pycharm
|
|
135
|
+
.idea
|
|
136
|
+
poetry.lock
|
|
137
|
+
|
|
138
|
+
# Ignore dynaconf secret files
|
|
139
|
+
*.secrets.*
|
|
140
|
+
node_modules/
|
|
141
|
+
.DS_Store
|
|
142
|
+
|
|
143
|
+
.release-smoke-check/
|
|
144
|
+
.release-smoke-local/
|
|
145
|
+
.release-smoke-local2/
|
|
146
|
+
.uv-cache/
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: onestep-postgres
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: PostgreSQL connector plugin for onestep.
|
|
5
|
+
License: MIT
|
|
6
|
+
Requires-Python: >=3.9
|
|
7
|
+
Requires-Dist: onestep>=1.4.2
|
|
8
|
+
Requires-Dist: psycopg[binary]>=3.2.0
|
|
9
|
+
Requires-Dist: sqlalchemy>=2.0.0
|
|
10
|
+
Provides-Extra: dev
|
|
11
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
12
|
+
Provides-Extra: test
|
|
13
|
+
Requires-Dist: pytest>=8.0.0; extra == 'test'
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
|
|
16
|
+
# onestep-postgres
|
|
17
|
+
|
|
18
|
+
PostgreSQL connector plugin for onestep.
|
|
19
|
+
|
|
20
|
+
Install it with:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install onestep-postgres
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
YAML resources are available after the plugin is installed:
|
|
27
|
+
|
|
28
|
+
```yaml
|
|
29
|
+
resources:
|
|
30
|
+
pg:
|
|
31
|
+
type: postgres
|
|
32
|
+
dsn: "${POSTGRES_DSN}"
|
|
33
|
+
|
|
34
|
+
cursor:
|
|
35
|
+
type: postgres_cursor_store
|
|
36
|
+
connector: pg
|
|
37
|
+
|
|
38
|
+
users:
|
|
39
|
+
type: postgres_incremental
|
|
40
|
+
connector: pg
|
|
41
|
+
table: users
|
|
42
|
+
key: id
|
|
43
|
+
cursor: [updated_at, id]
|
|
44
|
+
state: cursor
|
|
45
|
+
|
|
46
|
+
processed:
|
|
47
|
+
type: postgres_table_sink
|
|
48
|
+
connector: pg
|
|
49
|
+
table: processed_users
|
|
50
|
+
mode: upsert
|
|
51
|
+
keys: [id]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The first version supports table queues, incremental polling, table sinks, and
|
|
55
|
+
SQLAlchemy-backed state/cursor stores. It does not support PostgreSQL logical
|
|
56
|
+
replication or CDC.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# onestep-postgres
|
|
2
|
+
|
|
3
|
+
PostgreSQL connector plugin for onestep.
|
|
4
|
+
|
|
5
|
+
Install it with:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install onestep-postgres
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
YAML resources are available after the plugin is installed:
|
|
12
|
+
|
|
13
|
+
```yaml
|
|
14
|
+
resources:
|
|
15
|
+
pg:
|
|
16
|
+
type: postgres
|
|
17
|
+
dsn: "${POSTGRES_DSN}"
|
|
18
|
+
|
|
19
|
+
cursor:
|
|
20
|
+
type: postgres_cursor_store
|
|
21
|
+
connector: pg
|
|
22
|
+
|
|
23
|
+
users:
|
|
24
|
+
type: postgres_incremental
|
|
25
|
+
connector: pg
|
|
26
|
+
table: users
|
|
27
|
+
key: id
|
|
28
|
+
cursor: [updated_at, id]
|
|
29
|
+
state: cursor
|
|
30
|
+
|
|
31
|
+
processed:
|
|
32
|
+
type: postgres_table_sink
|
|
33
|
+
connector: pg
|
|
34
|
+
table: processed_users
|
|
35
|
+
mode: upsert
|
|
36
|
+
keys: [id]
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The first version supports table queues, incremental polling, table sinks, and
|
|
40
|
+
SQLAlchemy-backed state/cursor stores. It does not support PostgreSQL logical
|
|
41
|
+
replication or CDC.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "onestep-postgres"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "PostgreSQL connector plugin for onestep."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.9"
|
|
7
|
+
license = { text = "MIT" }
|
|
8
|
+
dependencies = [
|
|
9
|
+
"onestep>=1.4.2",
|
|
10
|
+
"SQLAlchemy>=2.0.0",
|
|
11
|
+
"psycopg[binary]>=3.2.0",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
[project.optional-dependencies]
|
|
15
|
+
test = [
|
|
16
|
+
"pytest>=8.0.0",
|
|
17
|
+
]
|
|
18
|
+
dev = [
|
|
19
|
+
"pytest>=8.0.0",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
[project.entry-points."onestep.resources"]
|
|
23
|
+
postgres = "onestep_postgres:register"
|
|
24
|
+
|
|
25
|
+
[build-system]
|
|
26
|
+
requires = ["hatchling"]
|
|
27
|
+
build-backend = "hatchling.build"
|
|
28
|
+
|
|
29
|
+
[tool.hatch.build.targets.wheel]
|
|
30
|
+
packages = ["src/onestep_postgres"]
|
|
31
|
+
|
|
32
|
+
[tool.uv.sources]
|
|
33
|
+
onestep = { workspace = true }
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from importlib.metadata import PackageNotFoundError, version as _package_version
|
|
4
|
+
|
|
5
|
+
from .connector import (
|
|
6
|
+
IncrementalDelivery,
|
|
7
|
+
PostgresConnector,
|
|
8
|
+
PostgresIncrementalSource,
|
|
9
|
+
PostgresTableQueueDelivery,
|
|
10
|
+
PostgresTableQueueSource,
|
|
11
|
+
PostgresTableSink,
|
|
12
|
+
)
|
|
13
|
+
from .resources import register_resources
|
|
14
|
+
from .resilience import classify_sqlalchemy_error
|
|
15
|
+
from .state_sqlalchemy import SQLAlchemyCursorStore, SQLAlchemyStateStore
|
|
16
|
+
|
|
17
|
+
try:
|
|
18
|
+
__version__ = _package_version("onestep-postgres")
|
|
19
|
+
except PackageNotFoundError: # pragma: no cover - local source tree before install
|
|
20
|
+
__version__ = "dev"
|
|
21
|
+
|
|
22
|
+
register = register_resources
|
|
23
|
+
|
|
24
|
+
__all__ = [
|
|
25
|
+
"IncrementalDelivery",
|
|
26
|
+
"PostgresConnector",
|
|
27
|
+
"PostgresIncrementalSource",
|
|
28
|
+
"PostgresTableQueueDelivery",
|
|
29
|
+
"PostgresTableQueueSource",
|
|
30
|
+
"PostgresTableSink",
|
|
31
|
+
"SQLAlchemyCursorStore",
|
|
32
|
+
"SQLAlchemyStateStore",
|
|
33
|
+
"__version__",
|
|
34
|
+
"classify_sqlalchemy_error",
|
|
35
|
+
"register",
|
|
36
|
+
"register_resources",
|
|
37
|
+
]
|