in src/package/dataplexutils/metadata/wizard.py [0:0]
def generate_table_description(self, table_fqn, documentation_uri=None):
"""Generates metadata on the tabes.
Args:
table_fqn: The fully qualified name of the table
(e.g., 'project.dataset.table')
Returns:
None.
Raises:
NotFound: If the specified table does not exist.
"""
logger.info(f"Generating metadata for table {table_fqn}.")
self._table_exists(table_fqn)
# Get base information
logger.info(f"Getting schema for table {table_fqn}.")
table_schema_str, _ = self._`get_table_`schema(table_fqn)
logger.info(f"Getting sample for table {table_fqn}.")
table_sample = self._get_table_sample(
table_fqn, constants["DATA"]["NUM_ROWS_TO_SAMPLE"]
)
# Get additional information
logger.info(f"Getting table quality for table {table_fqn}.")
table_quality = self._get_table_quality(
self._client_options._use_data_quality, table_fqn
)
logger.info(f"Getting table profile for table {table_fqn}.")
table_profile = self._get_table_profile(
self._client_options._use_profile, table_fqn
)
logger.info(f"Getting source tables for table {table_fqn}.")
table_sources_info = self._get_table_sources_info(
self._client_options._use_lineage_tables, table_fqn
)
logger.info(f"Getting jobs calculating for table {table_fqn}.")
job_sources_info = self._get_job_sources(
self._client_options._use_lineage_processes, table_fqn
)
prompt_manager = PromptManager(
PromtType.PROMPT_TYPE_TABLE, self._client_options
)
if documentation_uri == "":
documentation_uri = None
# Get prompt
table_description_prompt = prompt_manager.get_promtp()
# Format prompt
table_description_prompt_expanded = table_description_prompt.format(
table_fqn=table_fqn,
table_schema_str=table_schema_str,
table_sample=table_sample,
table_profile=table_profile,
table_quality=table_quality,
table_sources_info=table_sources_info,
job_sources_info=job_sources_info,
)
#logger.info(f"Prompt used is: {table_description_prompt_expanded}.")
table_description = self._llm_inference(table_description_prompt_expanded,documentation_uri)
#logger.info(f"Generated description: {table_description}.")
# Update table
self._update_table_bq_description(table_fqn, table_description)
return "Table description generated successfully"