diff --git a/poetry.lock b/poetry.lock index bf85d0c6..f083e735 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1353,22 +1353,20 @@ files = [ [[package]] name = "singer-sdk" -version = "0.39.1" +version = "0.39.1.post9.dev0+477a5eb6" description = "A framework for building Singer taps" optional = false python-versions = ">=3.8" -files = [ - {file = "singer_sdk-0.39.1-py3-none-any.whl", hash = "sha256:0c66709678d36f584db313f19c64c7d3b443c6879e5e476b2934918581fb213e"}, - {file = "singer_sdk-0.39.1.tar.gz", hash = "sha256:1616ac22c6917ddf2267a53e8802c10247a5e742bfb284e9dc9632ef9dc50ca4"}, -] +files = [] +develop = false [package.dependencies] backoff = {version = ">=2.0.0", markers = "python_version < \"4\""} backports-datetime-fromisoformat = {version = ">=2.0.1", markers = "python_version < \"3.11\""} -click = ">=8.0,<9.0" +click = "~=8.0" fs = ">=2.4.16" importlib-metadata = {version = "<9.0.0", markers = "python_version < \"3.12\""} -importlib-resources = {version = ">=5.12.0,<6.2.0 || >6.2.0,<6.3.0 || >6.3.0,<6.3.1 || >6.3.1", markers = "python_version < \"3.10\""} +importlib-resources = {version = ">=5.12.0,!=6.2.0,!=6.3.0,!=6.3.1", markers = "python_version < \"3.10\""} inflection = ">=0.5.1" joblib = ">=1.3.0" jsonpath-ng = ">=1.5.3" @@ -1390,7 +1388,13 @@ faker = ["faker (>=22.5,<27.0)"] jwt = ["PyJWT (>=2.4,<3.0)", "cryptography (>=3.4.6)"] 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)"] +testing = ["pytest (>=7.2.1)"] + +[package.source] +type = "git" +url = "https://github.com/meltano/sdk.git" +reference = "HEAD" +resolved_reference = "477a5eb6879b9e133f1b43b821c26d590ab183bf" [[package]] name = "six" @@ -1662,4 +1666,4 @@ test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools", [metadata] lock-version = "2.0" python-versions = ">=3.8" -content-hash = "83bc02126c6ed34a108072042f3ce6fce2318c760d325d40e263fcccca79b73d" +content-hash = "92dea30a2c973b3f72aa6c0a185be78f6cf9a650a6b59704790c5a39b323ad2c" diff --git a/pyproject.toml b/pyproject.toml index 861058dd..91b9f25d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,7 +37,7 @@ sqlalchemy = "~=2.0" sshtunnel = "0.4.0" [tool.poetry.dependencies.singer-sdk] -version = "~=0.39.0" +git = "https://github.com/meltano/sdk.git" [tool.poetry.group.dev.dependencies] pytest = ">=7.4.2" diff --git a/target_postgres/connector.py b/target_postgres/connector.py index 358019f7..5788626e 100644 --- a/target_postgres/connector.py +++ b/target_postgres/connector.py @@ -33,6 +33,9 @@ ) from sshtunnel import SSHTunnelForwarder +if t.TYPE_CHECKING: + from singer_sdk.connectors.sql import FullyQualifiedName + class PostgresConnector(SQLConnector): """Sets up SQL Alchemy, and other Postgres related stuff.""" @@ -94,7 +97,7 @@ def interpret_content_encoding(self) -> bool: def prepare_table( # type: ignore[override] self, - full_table_name: str, + full_table_name: str | FullyQualifiedName, schema: dict, primary_keys: t.Sequence[str], connection: sa.engine.Connection, @@ -156,7 +159,7 @@ def prepare_table( # type: ignore[override] def copy_table_structure( self, - full_table_name: str, + full_table_name: str | FullyQualifiedName, from_table: sa.Table, connection: sa.engine.Connection, as_temp_table: bool = False, @@ -426,7 +429,7 @@ def create_empty_table( # type: ignore[override] def prepare_column( self, - full_table_name: str, + full_table_name: str | FullyQualifiedName, column_name: str, sql_type: sa.types.TypeEngine, connection: sa.engine.Connection | None = None, @@ -846,7 +849,7 @@ def get_table_columns( # type: ignore[override] def column_exists( # type: ignore[override] self, - full_table_name: str, + full_table_name: str | FullyQualifiedName, column_name: str, connection: sa.engine.Connection, ) -> bool: diff --git a/target_postgres/sinks.py b/target_postgres/sinks.py index 2c9e0a6f..4a5c0f1a 100644 --- a/target_postgres/sinks.py +++ b/target_postgres/sinks.py @@ -1,8 +1,20 @@ """Postgres target sink class, which handles writing streams.""" +from __future__ import annotations + import datetime import uuid -from typing import Any, Dict, Iterable, List, Optional, Sequence, Union, cast +from typing import ( + TYPE_CHECKING, + Any, + Dict, + Iterable, + List, + Optional, + Sequence, + Union, + cast, +) import sqlalchemy as sa from singer_sdk.sinks import SQLSink @@ -11,6 +23,9 @@ from target_postgres.connector import PostgresConnector +if TYPE_CHECKING: + from singer_sdk.connectors.sql import FullyQualifiedName + class PostgresSink(SQLSink): """Postgres target sink class.""" @@ -261,7 +276,7 @@ def column_representation( def generate_insert_statement( self, - full_table_name: str, + full_table_name: str | FullyQualifiedName, columns: List[sa.Column], # type: ignore[override] ) -> Union[str, Executable]: """Generate an insert statement for the given records. diff --git a/target_postgres/tests/test_target_postgres.py b/target_postgres/tests/test_target_postgres.py index a6a622e0..42224bf2 100644 --- a/target_postgres/tests/test_target_postgres.py +++ b/target_postgres/tests/test_target_postgres.py @@ -2,17 +2,15 @@ # flake8: noqa import copy -import datetime import io from contextlib import redirect_stdout from decimal import Decimal from pathlib import Path -import jsonschema import pytest import sqlalchemy from singer_sdk.exceptions import InvalidRecord, MissingKeyPropertiesError -from singer_sdk.testing import get_target_test_class, sync_end_to_end +from singer_sdk.testing import sync_end_to_end from sqlalchemy.dialects.postgresql import ARRAY from sqlalchemy.types import TEXT, TIMESTAMP