Skip to content

Commit afee941

Browse files
Merge branch 'main' into http-connector
2 parents fe06ab2 + b0a8621 commit afee941

29 files changed

+355
-210
lines changed

.github/workflows/constraints.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pip==23.2
1+
pip==23.2.1
22
poetry==1.5.1
33
pre-commit==3.3.3
44
nox==2023.4.22

.github/workflows/test.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ env:
3737

3838
jobs:
3939
tests:
40-
name: Test on ${{ matrix.python-version }} (${{ matrix.session }}) / ${{ matrix.os }}
40+
name: "Test on ${{ matrix.python-version }} (${{ matrix.session }}) / ${{ matrix.os }} / SQLAlchemy: ${{ matrix.sqlalchemy }}"
4141
runs-on: ${{ matrix.os }}
4242
env:
4343
NOXSESSION: ${{ matrix.session }}
@@ -47,9 +47,11 @@ jobs:
4747
session: [tests]
4848
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
4949
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
50+
sqlalchemy: ["2.*"]
5051
include:
51-
- { session: doctest, python-version: "3.10", os: "ubuntu-latest" }
52-
- { session: mypy, python-version: "3.8", os: "ubuntu-latest" }
52+
- { session: tests, python-version: "3.11", os: "ubuntu-latest", sqlalchemy: "1.*" }
53+
- { session: doctest, python-version: "3.10", os: "ubuntu-latest", sqlalchemy: "2.*" }
54+
- { session: mypy, python-version: "3.8", os: "ubuntu-latest", sqlalchemy: "2.*" }
5355

5456
steps:
5557
- name: Check out the repository
@@ -86,6 +88,8 @@ jobs:
8688
nox --version
8789
8890
- name: Run Nox
91+
env:
92+
SQLALCHEMY_VERSION: ${{ matrix.sqlalchemy }}
8993
run: |
9094
nox --python=${{ matrix.python-version }}
9195

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ repos:
3636
)$
3737
3838
- repo: https://github.com/python-jsonschema/check-jsonschema
39-
rev: 0.23.2
39+
rev: 0.23.3
4040
hooks:
4141
- id: check-dependabot
4242
- id: check-github-workflows
4343
- id: check-readthedocs
4444

4545
- repo: https://github.com/astral-sh/ruff-pre-commit
46-
rev: v0.0.277
46+
rev: v0.0.280
4747
hooks:
4848
- id: ruff
4949
args: [--fix, --exit-non-zero-on-fix, --show-fixes]

docs/deprecation.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ incompatible way, following their deprecation, as indicated in the
1111
[`RESTStream.get_new_paginator`](singer_sdk.RESTStream.get_new_paginator).
1212

1313
See the [migration guide](./guides/pagination-classes.md) for more information.
14+
15+
- The `singer_sdk.testing.get_standard_tap_tests` and `singer_sdk.testing.get_standard_target_tests` functions will be removed. Replace them with `singer_sdk.testing.get_tap_test_class` and `singer_sdk.testing.get_target_test_class` functions respective to generate a richer test suite.

noxfile.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ def tests(session: Session) -> None:
8686
session.install(".[s3]")
8787
session.install(*test_dependencies)
8888

89+
sqlalchemy_version = os.environ.get("SQLALCHEMY_VERSION")
90+
if sqlalchemy_version:
91+
# Bypass nox-poetry use of --constraint so we can install a version of
92+
# SQLAlchemy that doesn't match what's in poetry.lock.
93+
session.poetry.session.install( # type: ignore[attr-defined]
94+
f"sqlalchemy=={sqlalchemy_version}",
95+
)
96+
8997
try:
9098
session.run(
9199
"coverage",
@@ -96,9 +104,6 @@ def tests(session: Session) -> None:
96104
"-v",
97105
"--durations=10",
98106
*session.posargs,
99-
env={
100-
"SQLALCHEMY_WARN_20": "1",
101-
},
102107
)
103108
finally:
104109
if session.interactive:

poetry.lock

Lines changed: 122 additions & 132 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ memoization = ">=0.3.2,<0.5.0"
5252
jsonpath-ng = "^1.5.3"
5353
joblib = "^1.0.1"
5454
inflection = "^0.5.1"
55-
sqlalchemy = "^1.4"
55+
sqlalchemy = ">=1.4,<3.0"
5656
python-dotenv = ">=0.20,<0.22"
5757
typing-extensions = "^4.2.0"
5858
simplejson = "^3.17.6"
@@ -109,7 +109,6 @@ numpy = [
109109
{ version = ">=1.22", python = ">=3.8" },
110110
]
111111
requests-mock = "^1.10.0"
112-
sqlalchemy2-stubs = {version = "^0.0.2a32", allow-prereleases = true}
113112
types-jsonschema = "^4.17.0.6"
114113
types-python-dateutil = "^2.8.19"
115114
types-pytz = ">=2022.7.1.2,<2024.0.0.0"
@@ -133,9 +132,6 @@ exclude = ".*simpleeval.*"
133132

134133
[tool.pytest.ini_options]
135134
addopts = '-vvv --ignore=singer_sdk/helpers/_simpleeval.py -m "not external"'
136-
filterwarnings = [
137-
"error::sqlalchemy.exc.RemovedIn20Warning",
138-
]
139135
markers = [
140136
"external: Tests relying on external resources",
141137
"windows: Tests that only run on Windows",
@@ -191,9 +187,6 @@ fail_under = 82
191187
[tool.mypy]
192188
exclude = "tests"
193189
files = "singer_sdk"
194-
plugins = [
195-
"sqlalchemy.ext.mypy.plugin",
196-
]
197190
python_version = "3.8"
198191
warn_unused_configs = true
199192
warn_unused_ignores = true
@@ -216,11 +209,13 @@ requires = ["poetry-core>=1.0.0"]
216209
build-backend = "poetry.core.masonry.api"
217210

218211
[tool.poetry.scripts]
219-
pytest11 = { callable = "singer_sdk:testing.pytest_plugin", extras = ["testing"] }
212+
pytest11 = { reference = "singer_sdk:testing.pytest_plugin", extras = ["testing"], type = "console" }
220213

221214
[tool.ruff]
222215
exclude = [
223216
"cookiecutter/*",
217+
"singer_sdk/helpers/_simpleeval.py",
218+
"tests/core/test_simpleeval.py",
224219
]
225220
ignore = [
226221
"ANN101", # Missing type annotation for `self` in method

singer_sdk/connectors/sql.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def get_sqlalchemy_url(self, config: t.Mapping[str, t.Any]) -> str:
197197
@staticmethod
198198
def to_jsonschema_type(
199199
sql_type: (
200-
str
200+
str # noqa: ANN401
201201
| sqlalchemy.types.TypeEngine
202202
| type[sqlalchemy.types.TypeEngine]
203203
| t.Any

singer_sdk/helpers/_compat.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,9 @@
1212
from typing import Protocol, final # noqa: ICN003
1313

1414
__all__ = ["metadata", "final", "Protocol"]
15+
if sys.version_info < (3, 9):
16+
import importlib_resources as resources
17+
else:
18+
from importlib import resources
19+
20+
__all__ = ["metadata", "final", "resources", "Protocol"]

singer_sdk/helpers/_flattening.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -252,15 +252,15 @@ def _flatten_schema( # noqa: C901
252252
else:
253253
items.append((new_key, v))
254254
elif len(v.values()) > 0:
255-
if list(v.values())[0][0]["type"] == "string":
256-
list(v.values())[0][0]["type"] = ["null", "string"]
257-
items.append((new_key, list(v.values())[0][0]))
258-
elif list(v.values())[0][0]["type"] == "array":
259-
list(v.values())[0][0]["type"] = ["null", "array"]
260-
items.append((new_key, list(v.values())[0][0]))
261-
elif list(v.values())[0][0]["type"] == "object":
262-
list(v.values())[0][0]["type"] = ["null", "object"]
263-
items.append((new_key, list(v.values())[0][0]))
255+
if next(iter(v.values()))[0]["type"] == "string":
256+
next(iter(v.values()))[0]["type"] = ["null", "string"]
257+
items.append((new_key, next(iter(v.values()))[0]))
258+
elif next(iter(v.values()))[0]["type"] == "array":
259+
next(iter(v.values()))[0]["type"] = ["null", "array"]
260+
items.append((new_key, next(iter(v.values()))[0]))
261+
elif next(iter(v.values()))[0]["type"] == "object":
262+
next(iter(v.values()))[0]["type"] = ["null", "object"]
263+
items.append((new_key, next(iter(v.values()))[0]))
264264

265265
# Sort and check for duplicates
266266
def _key_func(item):

0 commit comments

Comments
 (0)