in src/package/dataplexutils/metadata/wizard.py [0:0]
def _get_table_sample(self, table_fqn, num_rows_to_sample):
"""Add stringdocs
Args:
Add stringdocs
Raises:
Add stringdocs
"""
try:
bq_client = self._cloud_clients[constants["CLIENTS"]["BIGQUERY"]]
query = f"SELECT * FROM `{table_fqn}` LIMIT {num_rows_to_sample}"
return bq_client.query(query).to_dataframe().to_json()
except bigquery.exceptions.BadRequest as e:
print(f"BigQuery Bad Request: {e}")
return "[]"
except Exception as e:
logger.error(f"Exception: {e}.")
raise e