diff --git a/ingestion/src/metadata/ingestion/source/database/couchbase/metadata.py b/ingestion/src/metadata/ingestion/source/database/couchbase/metadata.py index 7201971da50..67f90c472e6 100644 --- a/ingestion/src/metadata/ingestion/source/database/couchbase/metadata.py +++ b/ingestion/src/metadata/ingestion/source/database/couchbase/metadata.py @@ -27,10 +27,7 @@ from metadata.ingestion.source.database.common_nosql_source import ( SAMPLE_SIZE, CommonNoSQLSource, ) -from metadata.ingestion.source.database.couchbase.queries import ( - COUCHBASE_GET_DATA, - COUCHBASE_SQL_STATEMENT, -) +from metadata.ingestion.source.database.couchbase.queries import COUCHBASE_GET_DATA from metadata.utils.logger import ingestion_logger logger = ingestion_logger() @@ -111,18 +108,14 @@ class CouchbaseSource(CommonNoSQLSource): """ try: database_name = self.context.get().database - query = COUCHBASE_SQL_STATEMENT.format(table_name=table_name) - result = self.couchbase.query(query) - for row in result.rows(): - if len(row) > 0: - query_coln = COUCHBASE_GET_DATA.format( - database_name=database_name, - schema_name=schema_name, - table_name=table_name, - sample_size=SAMPLE_SIZE, - ) - query_iter = self.couchbase.query(query_coln) - return list(query_iter.rows()) + query_coln = COUCHBASE_GET_DATA.format( + database_name=database_name, + schema_name=schema_name, + table_name=table_name, + sample_size=SAMPLE_SIZE, + ) + query_iter = self.couchbase.query(query_coln) + return list(query_iter.rows()) except Exception as exp: logger.debug(f"Failed to list column names for table [{table_name}]: {exp}") logger.debug(traceback.format_exc()) diff --git a/ingestion/src/metadata/ingestion/source/database/couchbase/queries.py b/ingestion/src/metadata/ingestion/source/database/couchbase/queries.py index 40a783eb4c1..3a32d74d66f 100644 --- a/ingestion/src/metadata/ingestion/source/database/couchbase/queries.py +++ b/ingestion/src/metadata/ingestion/source/database/couchbase/queries.py @@ -14,10 +14,6 @@ SQL Queries used during ingestion import textwrap -COUCHBASE_SQL_STATEMENT = textwrap.dedent( - """ SELECT * FROM system:indexes WHERE keyspace_id = '{table_name}' AND is_primary = TRUE """ -) - COUCHBASE_GET_DATA = textwrap.dedent( """ select crc.* from `{database_name}`.`{schema_name}`.`{table_name}` crc limit {sample_size} """ )