Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Commit

Permalink
[AP-473] Refactor logging (#37)
Browse files Browse the repository at this point in the history
* switch to pipelinewise-singer-python

* add a sample logging file
  • Loading branch information
Samira-El authored Feb 10, 2020
1 parent 7ad76e5 commit 903f5a5
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 16 deletions.
25 changes: 25 additions & 0 deletions sample_logging.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[loggers]
keys=root

[handlers]
keys=stderr

[formatters]
keys=child

[logger_root]
level=INFO
handlers=stderr
formatter=child
propagate=0

[handler_stderr]
level=INFO
class=StreamHandler
formatter=child
args=(sys.stderr,)

[formatter_child]
class=logging.Formatter
format=time=%(asctime)s name=%(name)s level=%(levelname)s message=%(message)s
datefmt=%Y-%m-%d %H:%M:%S
11 changes: 8 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from setuptools import setup

with open('README.md') as f:
long_description = f.read()
long_description = f.read()

setup(name='pipelinewise-tap-postgres',
version='1.3.1',
Expand All @@ -17,11 +17,16 @@
'Programming Language :: Python :: 3 :: Only'
],
install_requires=[
'singer-python==5.8.1',
'pipelinewise-singer-python==1.*',
'psycopg2==2.8.4',
'strict-rfc3339==0.7',
'nose==1.3.7'
],
extras_require={
"test": [
'nose==1.3.7',
'pylint==2.4.2'
]
},
entry_points='''
[console_scripts]
tap-postgres=tap_postgres:main
Expand Down
6 changes: 4 additions & 2 deletions tap_postgres/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@
import tap_postgres.sync_strategies.incremental as incremental
import tap_postgres.db as post_db
import tap_postgres.sync_strategies.common as sync_common
LOGGER = singer.get_logger()

#LogMiner do not support LONG, LONG RAW, CLOB, BLOB, NCLOB, ADT, or COLLECTION datatypes.

LOGGER = singer.get_logger('tap_postgres')

# LogMiner do not support LONG, LONG RAW, CLOB, BLOB, NCLOB, ADT, or COLLECTION datatypes.
Column = collections.namedtuple('Column', [
"column_name",
"is_primary_key",
Expand Down
3 changes: 2 additions & 1 deletion tap_postgres/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import psycopg2
import psycopg2.extras
import singer
LOGGER = singer.get_logger()

LOGGER = singer.get_logger('tap_postgres')

cursor_iter_size = 20000

Expand Down
2 changes: 1 addition & 1 deletion tap_postgres/sync_strategies/full_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import singer.metrics as metrics
import tap_postgres.db as post_db

LOGGER = singer.get_logger()
LOGGER = singer.get_logger('tap_postgres')

UPDATE_BOOKMARK_PERIOD = 1000

Expand Down
2 changes: 1 addition & 1 deletion tap_postgres/sync_strategies/incremental.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import tap_postgres.db as post_db


LOGGER = singer.get_logger()
LOGGER = singer.get_logger('tap_postgres')

UPDATE_BOOKMARK_PERIOD = 10000

Expand Down
13 changes: 5 additions & 8 deletions tap_postgres/sync_strategies/logical_replication.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,19 @@

import singer
import datetime
import time
import pytz
import decimal
from singer import utils, get_bookmark
import psycopg2
import copy
import json
import singer.metadata as metadata
import tap_postgres.db as post_db
import tap_postgres.sync_strategies.common as sync_common
from singer import utils, get_bookmark
from dateutil.parser import parse
import psycopg2
import copy
from select import select
from functools import reduce
import json
import re

LOGGER = singer.get_logger()
LOGGER = singer.get_logger('tap_postgres')

UPDATE_BOOKMARK_PERIOD = 10000

Expand Down

0 comments on commit 903f5a5

Please sign in to comment.