Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Test with singer-sdk @ main
Browse files Browse the repository at this point in the history
edgarrmondragon committed Jan 23, 2024
1 parent 402d023 commit 5d4c22d
Showing 5 changed files with 255 additions and 255 deletions.
488 changes: 245 additions & 243 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ packages = [
[tool.poetry.dependencies]
python = "<3.13,>=3.8"
requests = "^2.25.1"
singer-sdk = ">=0.28,<0.35"
singer-sdk = {git = "https://github.com/meltano/sdk.git"}
psycopg2-binary = "2.9.9"
sqlalchemy = ">=2.0,<3.0"
sshtunnel = "0.4.0"
4 changes: 2 additions & 2 deletions target_postgres/connector.py
Original file line number Diff line number Diff line change
@@ -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:
6 changes: 3 additions & 3 deletions target_postgres/sinks.py
Original file line number Diff line number Diff line change
@@ -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.
10 changes: 4 additions & 6 deletions target_postgres/tests/test_target_postgres.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
""" Postgres target tests """
# 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 MissingKeyPropertiesError
from singer_sdk.testing import get_target_test_class, sync_end_to_end
from singer_sdk.exceptions import InvalidRecord, MissingKeyPropertiesError
from singer_sdk.testing import sync_end_to_end
from sqlalchemy.dialects.postgresql import ARRAY
from sqlalchemy.types import TEXT, TIMESTAMP

@@ -234,8 +232,8 @@ def test_record_missing_key_property(postgres_target):


def test_record_missing_required_property(postgres_target):
with pytest.raises(jsonschema.exceptions.ValidationError):
file_name = "record_missing_required_property.singer"
file_name = "record_missing_required_property.singer"
with pytest.raises(InvalidRecord):
singer_file_to_target(file_name, postgres_target)


0 comments on commit 5d4c22d

Please sign in to comment.