Skip to content

Commit 9329a43

Browse files
Fix additional errors
1 parent 0238b82 commit 9329a43

File tree

7 files changed

+35
-35
lines changed

7 files changed

+35
-35
lines changed

.pre-commit-config.yaml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,25 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v2.3.0
3+
rev: v4.5.0
44
hooks:
55
- id: check-yaml
66
- id: end-of-file-fixer
77
- id: trailing-whitespace
88
- repo: https://github.com/psf/black
9-
rev: 22.10.0
9+
rev: 23.12.1
1010
hooks:
1111
- id: black
1212
- repo: https://github.com/pycqa/isort
13-
rev: 5.12.0
13+
rev: 5.13.2
1414
hooks:
1515
- id: isort
1616
- repo: https://github.com/python-poetry/poetry
17-
rev: 1.3.2
17+
rev: 1.7.0
1818
hooks:
1919
- id: poetry-check
2020
- id: poetry-lock
2121
args: [--no-update]
22-
- repo: https://github.com/pre-commit/mirrors-mypy
23-
rev: 'v0.991'
24-
hooks:
25-
- id: mypy
26-
exclude: tests
27-
additional_dependencies:
28-
- types-paramiko
2922
- repo: https://github.com/pycqa/flake8
30-
rev: 6.1.0
23+
rev: 7.0.0
3124
hooks:
32-
- id: flake8
25+
- id: flake8

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,4 +261,4 @@ Note also that using log-based replication will cause the replication key for al
261261
"*":
262262
replication_method: LOG_BASED
263263
replication_key: _sdc_lsn
264-
```
264+
```

log_based/init.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
SELECT * FROM pg_create_logical_replication_slot('tappostgres', 'wal2json');
1+
SELECT * FROM pg_create_logical_replication_slot('tappostgres', 'wal2json');

poetry.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tap_postgres/client.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ def sdk_typing_object(
178178
| th.DateType
179179
| th.StringType
180180
| th.BooleanType
181+
| th.CustomType
181182
):
182183
"""Return the JSON Schema dict that describes the sql type.
183184
@@ -209,14 +210,15 @@ def sdk_typing_object(
209210
| th.IntegerType
210211
| th.DateType
211212
| th.StringType
212-
| th.BooleanType,
213+
| th.BooleanType
214+
| th.CustomType,
213215
] = {
214-
"jsonb": th.CustomType({
215-
"type": ["string", "number", "integer", "array", "object", "boolean"]
216-
}),
217-
"json": th.CustomType({
218-
"type": ["string", "number", "integer", "array", "object", "boolean"]
219-
}),
216+
"jsonb": th.CustomType(
217+
{"type": ["string", "number", "integer", "array", "object", "boolean"]}
218+
),
219+
"json": th.CustomType(
220+
{"type": ["string", "number", "integer", "array", "object", "boolean"]}
221+
),
220222
"timestamp": th.DateTimeType(),
221223
"datetime": th.DateTimeType(),
222224
"date": th.DateType(),
@@ -475,11 +477,13 @@ def consume(self, message) -> dict | None:
475477
elif message_payload["action"] in delete_actions:
476478
for column in message_payload["identity"]:
477479
row.update({column["name"]: column["value"]})
478-
row.update({
479-
"_sdc_deleted_at": datetime.datetime.utcnow().strftime(
480-
r"%Y-%m-%dT%H:%M:%SZ"
481-
)
482-
})
480+
row.update(
481+
{
482+
"_sdc_deleted_at": datetime.datetime.utcnow().strftime(
483+
r"%Y-%m-%dT%H:%M:%SZ"
484+
)
485+
}
486+
)
483487
row.update({"_sdc_lsn": message.data_start})
484488
elif message_payload["action"] in truncate_actions:
485489
self.logger.debug(

tests/test_core.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
from singer_sdk.testing.runners import TapTestRunner
1212
from sqlalchemy import Column, DateTime, Integer, MetaData, Numeric, String, Table, text
1313
from sqlalchemy.dialects.postgresql import (
14+
ARRAY,
1415
BIGINT,
1516
DATE,
1617
JSON,
1718
JSONB,
1819
TIME,
1920
TIMESTAMP,
20-
ARRAY,
2121
)
2222
from tests.settings import DB_SCHEMA_NAME, DB_SQLALCHEMY_URL
2323
from tests.test_replication_key import TABLE_NAME, TapTestReplicationKey
@@ -418,13 +418,13 @@ def run_sync_dry_run(self) -> bool:
418418
return True
419419

420420

421-
def test_invalid_python_dates():
421+
def test_invalid_python_dates(): # noqa: C901
422422
"""Some dates are invalid in python, but valid in Postgres
423423
424424
Check out https://www.psycopg.org/psycopg3/docs/advanced/adapt.html#example-handling-infinity-date
425425
for more information.
426426
427-
"""
427+
""" # noqa: E501
428428
table_name = "test_invalid_python_dates"
429429
engine = sqlalchemy.create_engine(SAMPLE_CONFIG["sqlalchemy_url"], future=True)
430430

tests/test_log_based.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
import sqlalchemy
44
from sqlalchemy import Column, MetaData, Table
55
from sqlalchemy.dialects.postgresql import BIGINT, TEXT
6-
from tap_postgres.tap import TapPostgres
76
from tests.test_core import PostgresTestRunner
87

8+
from tap_postgres.tap import TapPostgres
99

1010
LOG_BASED_CONFIG = {
1111
"host": "localhost",
@@ -15,6 +15,7 @@
1515
"database": "postgres",
1616
}
1717

18+
1819
def test_null_append():
1920
"""LOG_BASED syncs failed with string property types. (issue #294).
2021
@@ -23,14 +24,16 @@ def test_null_append():
2324
LOG_BASED replication can still append the "null" option to a property's type.
2425
"""
2526
table_name = "test_null_append"
26-
engine = sqlalchemy.create_engine("postgresql://postgres:postgres@localhost:5434/postgres")
27+
engine = sqlalchemy.create_engine(
28+
"postgresql://postgres:postgres@localhost:5434/postgres"
29+
)
2730

2831
metadata_obj = MetaData()
2932
table = Table(
3033
table_name,
3134
metadata_obj,
32-
Column("id", BIGINT, primary_key = True),
33-
Column("data", TEXT, nullable = True)
35+
Column("id", BIGINT, primary_key=True),
36+
Column("data", TEXT, nullable=True),
3437
)
3538
with engine.connect() as conn:
3639
table.drop(conn, checkfirst=True)

0 commit comments

Comments
 (0)