Skip to content

Commit 0588e79

Browse files
test: Test with singer-sdk @ main
1 parent a8cb2b9 commit 0588e79

File tree

5 files changed

+39
-19
lines changed

5 files changed

+39
-19
lines changed

poetry.lock

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

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ sqlalchemy = "~=2.0"
3737
sshtunnel = "0.4.0"
3838

3939
[tool.poetry.dependencies.singer-sdk]
40-
version = "~=0.39.0"
40+
git = "https://github.com/meltano/sdk.git"
4141

4242
[tool.poetry.group.dev.dependencies]
4343
pytest = ">=7.4.2"

target_postgres/connector.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
)
3434
from sshtunnel import SSHTunnelForwarder
3535

36+
if t.TYPE_CHECKING:
37+
from singer_sdk.connectors.sql import FullyQualifiedName
38+
3639

3740
class PostgresConnector(SQLConnector):
3841
"""Sets up SQL Alchemy, and other Postgres related stuff."""
@@ -94,7 +97,7 @@ def interpret_content_encoding(self) -> bool:
9497

9598
def prepare_table( # type: ignore[override]
9699
self,
97-
full_table_name: str,
100+
full_table_name: str | FullyQualifiedName,
98101
schema: dict,
99102
primary_keys: t.Sequence[str],
100103
connection: sa.engine.Connection,
@@ -156,7 +159,7 @@ def prepare_table( # type: ignore[override]
156159

157160
def copy_table_structure(
158161
self,
159-
full_table_name: str,
162+
full_table_name: str | FullyQualifiedName,
160163
from_table: sa.Table,
161164
connection: sa.engine.Connection,
162165
as_temp_table: bool = False,
@@ -426,7 +429,7 @@ def create_empty_table( # type: ignore[override]
426429

427430
def prepare_column(
428431
self,
429-
full_table_name: str,
432+
full_table_name: str | FullyQualifiedName,
430433
column_name: str,
431434
sql_type: sa.types.TypeEngine,
432435
connection: sa.engine.Connection | None = None,
@@ -846,7 +849,7 @@ def get_table_columns( # type: ignore[override]
846849

847850
def column_exists( # type: ignore[override]
848851
self,
849-
full_table_name: str,
852+
full_table_name: str | FullyQualifiedName,
850853
column_name: str,
851854
connection: sa.engine.Connection,
852855
) -> bool:

target_postgres/sinks.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
"""Postgres target sink class, which handles writing streams."""
22

3+
from __future__ import annotations
4+
35
import datetime
46
import uuid
5-
from typing import Any, Dict, Iterable, List, Optional, Sequence, Union, cast
7+
from typing import (
8+
TYPE_CHECKING,
9+
Any,
10+
Dict,
11+
Iterable,
12+
List,
13+
Optional,
14+
Sequence,
15+
Union,
16+
cast,
17+
)
618

719
import sqlalchemy as sa
820
from singer_sdk.sinks import SQLSink
@@ -11,6 +23,9 @@
1123

1224
from target_postgres.connector import PostgresConnector
1325

26+
if TYPE_CHECKING:
27+
from singer_sdk.connectors.sql import FullyQualifiedName
28+
1429

1530
class PostgresSink(SQLSink):
1631
"""Postgres target sink class."""
@@ -261,7 +276,7 @@ def column_representation(
261276

262277
def generate_insert_statement(
263278
self,
264-
full_table_name: str,
279+
full_table_name: str | FullyQualifiedName,
265280
columns: List[sa.Column], # type: ignore[override]
266281
) -> Union[str, Executable]:
267282
"""Generate an insert statement for the given records.

target_postgres/tests/test_target_postgres.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@
22

33
# flake8: noqa
44
import copy
5-
import datetime
65
import io
76
from contextlib import redirect_stdout
87
from decimal import Decimal
98
from pathlib import Path
109

11-
import jsonschema
1210
import pytest
1311
import sqlalchemy
1412
from singer_sdk.exceptions import InvalidRecord, MissingKeyPropertiesError
15-
from singer_sdk.testing import get_target_test_class, sync_end_to_end
13+
from singer_sdk.testing import sync_end_to_end
1614
from sqlalchemy.dialects.postgresql import ARRAY
1715
from sqlalchemy.types import TEXT, TIMESTAMP
1816

0 commit comments

Comments
 (0)