Skip to content

Commit

Permalink
done
Browse files Browse the repository at this point in the history
  • Loading branch information
nidhi-akkio committed Nov 27, 2023
1 parent 78fa22b commit 6abc66e
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions tap_snowflake/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from typing import Any, Iterable, List, Tuple
from uuid import uuid4
import datetime
import re

import sqlalchemy
from singer_sdk import SQLConnector, SQLStream, metrics
Expand Down Expand Up @@ -99,7 +100,7 @@ def create_engine(self) -> sqlalchemy.engine.Engine:
self.sqlalchemy_url,
echo=False,
pool_timeout=10,
)
)

# overridden to filter out the information_schema from catalog discovery
def discover_catalog_entries(self) -> list[dict]:
Expand All @@ -110,25 +111,24 @@ def discover_catalog_entries(self) -> list[dict]:
"""
result: list[dict] = []
tables = [t.lower() for t in self.config.get("tables", [])]
result.append(self.config)
engine = self.create_sqlalchemy_engine()
inspected = sqlalchemy.inspect(engine)
schema_names = [
schema_name
for schema_name in self.get_schema_names(engine, inspected)
if schema_name.lower() != "information_schema"
]
#print("This is self.config: %s", self.config)
#print(self.config)
print("This is the schema_names: %s", schema_names)
print("This is the tables: %s", tables)
self.logger.info("This is tables")
self.logger.info(tables)
self.logger.info("This is schema_names")
self.logger.info(schema_names)
self.logger.info(self.config)

if self.config.get("schema"):
schema_names = []
schema_names.append(self.config.get("schema"))

else:
schema_names = [
schema_name
for schema_name in self.get_schema_names(engine, inspected)
if schema_name.lower() != "information_schema"
]

for schema_name in schema_names:
# Iterate through each table and view
# We shouldn't have to iterate through every table in a schema if tables are provided
# However, the only way to get is_view for tables is self.get_object_names with schema
for table_name, is_view in self.get_object_names(
engine, inspected, schema_name
):
Expand Down

0 comments on commit 6abc66e

Please sign in to comment.