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

Commit

Permalink
Merge pull request #2 from Monad-Inc/fix/add_debugging_and_database
Browse files Browse the repository at this point in the history
Fix/add debugging and database
  • Loading branch information
santiagocasti authored Oct 14, 2022
2 parents ef2aa95 + 829b209 commit 5e96786
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 6 additions & 3 deletions tap_redshift/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ def discover_catalog(conn, db_schema):
stream=table_name,
schema=schema,
table=qualified_table_name,
metadata=metadata)
metadata=metadata,
database=db_name)

entries.append(entry)

Expand Down Expand Up @@ -251,7 +252,7 @@ def open_connection(config):
dbname = config['dbname'],
user = config['user'],
password = config['password']

LOGGER.info(f"Attempting Redshift connection: {dbname[0]} {host[0]} {port[0]}")
connection = psycopg2.connect(
host=host[0],
port=port[0],
Expand Down Expand Up @@ -304,8 +305,10 @@ def sync_table(connection, catalog_entry, state):
LOGGER.info('Beginning sync for {} table'.format(tap_stream_id))
with connection.cursor() as cursor:
schema, table = catalog_entry.table.split('.')
select = 'SELECT {} FROM {}.{}'.format(
database = catalog_entry.database
select = 'SELECT {} FROM {}.{}.{}'.format(
','.join('"{}"'.format(c) for c in columns),
'"{}"'.format(database),
'"{}"'.format(schema),
'"{}"'.format(table))
params = {}
Expand Down
3 changes: 2 additions & 1 deletion tap_redshift/resolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ def resolve_catalog(discovered, catalog, state):
stream=catalog_entry.stream,
table=catalog_entry.table,
schema=schema,
metadata=catalog_entry.metadata
metadata=catalog_entry.metadata,
database=catalog_entry.database
))

return result

0 comments on commit 5e96786

Please sign in to comment.