diff --git a/poetry.lock b/poetry.lock index a7965852..d93942a9 100644 --- a/poetry.lock +++ b/poetry.lock @@ -568,13 +568,13 @@ files = [ [[package]] name = "importlib-metadata" -version = "6.11.0" +version = "7.0.1" description = "Read metadata from Python packages" optional = false python-versions = ">=3.8" files = [ - {file = "importlib_metadata-6.11.0-py3-none-any.whl", hash = "sha256:f0afba6205ad8f8947c7d338b5342d5db2afbfd82f9cbef7879a9539cc12eb9b"}, - {file = "importlib_metadata-6.11.0.tar.gz", hash = "sha256:1231cf92d825c9e03cfc4da076a16de6422c863558229ea0b22b675657463443"}, + {file = "importlib_metadata-7.0.1-py3-none-any.whl", hash = "sha256:4805911c3a4ec7c3966410053e9ec6a1fecd629117df5adee56dfc9432a1081e"}, + {file = "importlib_metadata-7.0.1.tar.gz", hash = "sha256:f238736bb06590ae52ac1fab06a3a9ef1d8dce2b7a35b5ab329371d6c8f5d2cc"}, ] [package.dependencies] @@ -688,16 +688,6 @@ files = [ importlib-resources = {version = ">=1.4.0", markers = "python_version < \"3.9\""} referencing = ">=0.31.0" -[[package]] -name = "memoization" -version = "0.4.0" -description = "A powerful caching library for Python, with TTL support and multiple algorithm options. (https://github.com/lonelyenvoy/python-memoization)" -optional = false -python-versions = ">=3, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4" -files = [ - {file = "memoization-0.4.0.tar.gz", hash = "sha256:fde5e7cd060ef45b135e0310cfec17b2029dc472ccb5bbbbb42a503d4538a135"}, -] - [[package]] name = "mypy" version = "1.8.0" @@ -1145,17 +1135,6 @@ files = [ [package.extras] cli = ["click (>=5.0)"] -[[package]] -name = "pytz" -version = "2023.4" -description = "World timezone definitions, modern and historical" -optional = false -python-versions = "*" -files = [ - {file = "pytz-2023.4-py2.py3-none-any.whl", hash = "sha256:f90ef520d95e7c46951105338d918664ebfd6f1d995bd7d153127ce90efafa6a"}, - {file = "pytz-2023.4.tar.gz", hash = "sha256:31d4583c4ed539cd037956140d695e42c033a19e984bfce9964a3f7d59bc2b40"}, -] - [[package]] name = "pyyaml" version = "6.0.1" @@ -1533,13 +1512,13 @@ files = [ [[package]] name = "singer-sdk" -version = "0.34.1" +version = "0.35.0a5" description = "A framework for building Singer taps" optional = false -python-versions = ">=3.7.1" +python-versions = ">=3.8" files = [ - {file = "singer_sdk-0.34.1-py3-none-any.whl", hash = "sha256:2b9afa40722c2d7288992d86d16298128e38387941306267d908b9cd954227a3"}, - {file = "singer_sdk-0.34.1.tar.gz", hash = "sha256:5da11da3de07cc31cc8c1f3f19a40b8f8be4a0df9b5535fb90880c263e58aee5"}, + {file = "singer_sdk-0.35.0a5-py3-none-any.whl", hash = "sha256:220145bacb7709825acbb59d69faa324a9c26571b161fc7798dd7bafc81b8f1a"}, + {file = "singer_sdk-0.35.0a5.tar.gz", hash = "sha256:ed099380634668c61f3bd83693b493243fa26359912e82495409422e8c8b358b"}, ] [package.dependencies] @@ -1548,20 +1527,19 @@ backports-datetime-fromisoformat = {version = ">=2.0.1", markers = "python_versi click = ">=8.0,<9.0" cryptography = ">=3.4.6" fs = ">=2.4.16" -importlib-metadata = {version = "<7.0.0", markers = "python_version < \"3.12\""} +importlib-metadata = {version = "<8.0.0", markers = "python_version < \"3.12\""} importlib-resources = {version = ">=5.12.0", markers = "python_version < \"3.9\""} inflection = ">=0.5.1" joblib = ">=1.0.1" jsonpath-ng = ">=1.5.3" -jsonschema = {version = ">=4.16.0", markers = "python_version >= \"3.8\""} -memoization = {version = ">=0.3.2,<0.5.0", markers = "python_version < \"4\""} +jsonschema = ">=4.16.0" packaging = ">=23.1" -pendulum = {version = ">=2.1.0,<4", markers = "python_version >= \"3.8\""} +pendulum = ">=2.1.0,<4" PyJWT = ">=2.4,<3.0" python-dateutil = ">=2.8.2" python-dotenv = ">=0.20" -pytz = ">=2022.2.1" PyYAML = ">=6.0" +referencing = ">=0.30.0" requests = ">=2.25.1" simpleeval = ">=0.9.13" simplejson = ">=3.17.6" @@ -1571,7 +1549,8 @@ urllib3 = ">=1.26,<2" [package.extras] docs = ["furo (>=2022.12.7)", "myst-parser (>=1)", "sphinx (>=4.5)", "sphinx-autobuild (>=2021.3.14)", "sphinx-copybutton (>=0.3.1)", "sphinx-inline-tabs (>=2023.4.21)", "sphinx-notfound-page (>=1.0.0)", "sphinx-reredirects (>=0.1.1)"] -parquet = ["numpy (<1.22)", "numpy (>=1.22)", "numpy (>=1.22,<1.25)", "pyarrow (>=11,<13)", "pyarrow (>=13)"] +faker = ["faker (>=22.5,<23.0)"] +parquet = ["numpy (>=1.22)", "numpy (>=1.22,<1.25)", "pyarrow (>=13)"] s3 = ["fs-s3fs (>=1.1.1)"] testing = ["pytest (>=7.2.1)", "pytest-durations (>=1.2.0)"] @@ -1856,4 +1835,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = ">=3.8" -content-hash = "e6edcdd1ad2c91706171bcc872cb95d710968a9e1d70a6d34112e05cbd4073c7" +content-hash = "24418966d98cdebb26766fea82c9b814f0b612c70687402d17a606d95ddac50f" diff --git a/pyproject.toml b/pyproject.toml index 6f46ba09..6428281b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,7 +37,8 @@ sqlalchemy = "~=2.0" sshtunnel = "0.4.0" [tool.poetry.dependencies.singer-sdk] -version = "~=0.34.0" +allow-prereleases = true +version = ">=0.34.0" [tool.poetry.group.dev.dependencies] pytest = ">=7.4.2" diff --git a/target_postgres/connector.py b/target_postgres/connector.py index b8d3c907..9eb297b5 100644 --- a/target_postgres/connector.py +++ b/target_postgres/connector.py @@ -83,7 +83,7 @@ def prepare_table( # type: ignore[override] self, full_table_name: str, schema: dict, - primary_keys: list[str], + primary_keys: t.Sequence[str], connection: sa.engine.Connection, partition_keys: list[str] | None = None, as_temp_table: bool = False, @@ -316,7 +316,7 @@ def create_empty_table( # type: ignore[override] meta: sa.MetaData, schema: dict, connection: sa.engine.Connection, - primary_keys: list[str] | None = None, + primary_keys: t.Sequence[str] | None = None, partition_keys: list[str] | None = None, as_temp_table: bool = False, ) -> sa.Table: diff --git a/target_postgres/sinks.py b/target_postgres/sinks.py index 4173c5a2..ea8b8df3 100644 --- a/target_postgres/sinks.py +++ b/target_postgres/sinks.py @@ -1,7 +1,7 @@ """Postgres target sink class, which handles writing streams.""" import uuid -from typing import Any, Dict, Iterable, List, Optional, Union, cast +from typing import Any, Dict, Iterable, List, Optional, Sequence, Union, cast import sqlalchemy as sa from pendulum import now @@ -121,7 +121,7 @@ def bulk_insert_records( # type: ignore[override] table: sa.Table, schema: dict, records: Iterable[Dict[str, Any]], - primary_keys: List[str], + primary_keys: Sequence[str], connection: sa.engine.Connection, ) -> Optional[int]: """Bulk insert records to an existing destination table. @@ -178,7 +178,7 @@ def upsert( from_table: sa.Table, to_table: sa.Table, schema: dict, - join_keys: List[str], + join_keys: Sequence[str], connection: sa.engine.Connection, ) -> Optional[int]: """Merge upsert data from one table to another. diff --git a/target_postgres/tests/test_target_postgres.py b/target_postgres/tests/test_target_postgres.py index 93f56c30..35ccee25 100644 --- a/target_postgres/tests/test_target_postgres.py +++ b/target_postgres/tests/test_target_postgres.py @@ -7,10 +7,9 @@ from decimal import Decimal from pathlib import Path -import jsonschema import pytest import sqlalchemy -from singer_sdk.exceptions import MissingKeyPropertiesError +from singer_sdk.exceptions import InvalidRecord, MissingKeyPropertiesError from singer_sdk.testing import get_target_test_class, sync_end_to_end from sqlalchemy.dialects.postgresql import ARRAY from sqlalchemy.types import TEXT, TIMESTAMP @@ -234,7 +233,7 @@ def test_record_missing_key_property(postgres_target): def test_record_missing_required_property(postgres_target): - with pytest.raises(jsonschema.exceptions.ValidationError): + with pytest.raises(InvalidRecord): file_name = "record_missing_required_property.singer" singer_file_to_target(file_name, postgres_target)