Skip to content

Commit

Permalink
fix model name for generated models
Browse files Browse the repository at this point in the history
  • Loading branch information
Kayrnt committed Jul 30, 2024
1 parent b07023c commit df2c5af
Show file tree
Hide file tree
Showing 61 changed files with 70 additions and 70 deletions.
4 changes: 2 additions & 2 deletions documentation_parser/documentation_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def generate_files(
# Update the column list
columns = update_column_list(columns, exclude_columns)

base_filename = f"{dir}/information_schema_{filename}"
base_filename = f"output/{dir}/information_schema_{filename}"

# Create the YML file
filename_yml = f"{base_filename}.yml"
Expand All @@ -185,7 +185,7 @@ def generate_files(
"version": 2,
"models": [
{
"name": table_name.lower(),
"name": "information_schema_" + table_name.lower(),
"description": "dataset details with related information",
"columns": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ models:
name: GRANTEE
type: STRING
description: dataset details with related information
name: object_privileges
name: information_schema_object_privileges
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ models:
name: preferred_tables
type: REPEATED STRING
description: dataset details with related information
name: bi_capacities
name: information_schema_bi_capacities
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ models:
name: preferred_tables
type: REPEATED STRING
description: dataset details with related information
name: bi_capacity_changes
name: information_schema_bi_capacity_changes
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ models:
name: OPTION_SET_ON_ID
type: STRING
description: dataset details with related information
name: effective_project_options
name: information_schema_effective_project_options
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ models:
name: OPTION_VALUE
type: STRING
description: dataset details with related information
name: organization_options
name: information_schema_organization_options
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ models:
name: project_number
type: INTEGER
description: dataset details with related information
name: organization_options_changes
name: information_schema_organization_options_changes
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ models:
name: OPTION_VALUE
type: STRING
description: dataset details with related information
name: project_options
name: information_schema_project_options
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ models:
name: project_number
type: INTEGER
description: dataset details with related information
name: project_options_changes
name: information_schema_project_options_changes
version: 2
2 changes: 1 addition & 1 deletion models/base/google/datasets/information_schema_links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ models:
name: LINKED_SCHEMA_ORG_DISPLAY_NAME
type: STRING
description: dataset details with related information
name: schemata_links
name: information_schema_schemata_links
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ models:
name: DEFAULT_COLLATION_NAME
type: STRING
description: dataset details with related information
name: schemata
name: information_schema_schemata
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ models:
name: OPTION_VALUE
type: STRING
description: dataset details with related information
name: schemata_options
name: information_schema_schemata_options
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ models:
name: replication_time
type: TIMESTAMP
description: dataset details with related information
name: schemata_replicas
name: information_schema_schemata_replicas
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ models:
name: total_bytes_processed
type: INTEGER
description: dataset details with related information
name: shared_dataset_usage
name: information_schema_shared_dataset_usage
version: 2
2 changes: 1 addition & 1 deletion models/base/google/jobs/information_schema_jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,5 +150,5 @@ models:
name: query_info
type: RECORD
description: dataset details with related information
name: jobs
name: information_schema_jobs
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,5 @@ models:
name: query_info
type: RECORD
description: dataset details with related information
name: jobs_by_folder
name: information_schema_jobs_by_folder
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,5 @@ models:
name: query_info
type: RECORD
description: dataset details with related information
name: jobs_by_organization
name: information_schema_jobs_by_organization
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -150,5 +150,5 @@ models:
name: query_info
type: RECORD
description: dataset details with related information
name: jobs_by_project
name: information_schema_jobs_by_project
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -150,5 +150,5 @@ models:
name: query_info
type: RECORD
description: dataset details with related information
name: jobs_by_user
name: information_schema_jobs_by_user
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@ models:
name: period_estimated_runnable_units
type: INTEGER
description: dataset details with related information
name: jobs_timeline
name: information_schema_jobs_timeline
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,5 @@ models:
name: period_estimated_runnable_units
type: INTEGER
description: dataset details with related information
name: jobs_timeline_by_folder
name: information_schema_jobs_timeline_by_folder
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,5 @@ models:
name: period_estimated_runnable_units
type: INTEGER
description: dataset details with related information
name: jobs_timeline_by_organization
name: information_schema_jobs_timeline_by_organization
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@ models:
name: period_estimated_runnable_units
type: INTEGER
description: dataset details with related information
name: jobs_timeline_by_user
name: information_schema_jobs_timeline_by_user
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ models:
name: state
type: STRING
description: dataset details with related information
name: assignment_changes
name: information_schema_assignment_changes
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ models:
name: reservation_name
type: STRING
- description: "The type of job that can use the reservation. Can be\n PIPELINE,\
\ QUERY, ML_EXTERNAL, or\n BACKGROUND."
\ QUERY, CONTINUOUS,\n ML_EXTERNAL, or BACKGROUND."
name: job_type
type: STRING
- description: ID that uniquely identifies the assignee resource.
Expand All @@ -30,5 +30,5 @@ models:
name: assignee_type
type: STRING
description: dataset details with related information
name: assignments
name: information_schema_assignments
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ models:
name: is_flat_rate
type: BOOL
description: dataset details with related information
name: capacity_commitment_changes
name: information_schema_capacity_commitment_changes
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ models:
name: renewal_plan
type: STRING
description: dataset details with related information
name: capacity_commitments
name: information_schema_capacity_commitments
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ models:
name: edition
type: STRING
description: dataset details with related information
name: reservation_changes
name: information_schema_reservation_changes
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ models:
name: edition
type: STRING
description: dataset details with related information
name: reservations
name: information_schema_reservations
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ models:
name: reservation_id
type: STRING
description: dataset details with related information
name: reservations_timeline
name: information_schema_reservations_timeline
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ models:
name: IS_AGGREGATE
type: STRING
description: dataset details with related information
name: parameters
name: information_schema_parameters
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ models:
name: OPTION_VALUE
type: STRING
description: dataset details with related information
name: routine_options
name: information_schema_routine_options
version: 2
4 changes: 2 additions & 2 deletions models/base/google/routines/information_schema_routines.sql
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ Access control with IAM. -#}
{% for project in project_list() -%}

SELECT specific_catalog, specific_schema, specific_name, routine_catalog, routine_schema, routine_name, routine_type, data_type, routine_body, routine_definition, external_language, is_deterministic, security_type, created, last_altered, ddl
FROM `{{ project | trim }}`.`region-{{ var('bq_region') }}`.`INFORMATION_SCHEMA`.`ROUTINE`
FROM `{{ project | trim }}`.`region-{{ var('bq_region') }}`.`INFORMATION_SCHEMA`.`ROUTINES`

{% if not loop.last %}UNION ALL{% endif %}
{% endfor %}
{%- else %}

SELECT specific_catalog, specific_schema, specific_name, routine_catalog, routine_schema, routine_name, routine_type, data_type, routine_body, routine_definition, external_language, is_deterministic, security_type, created, last_altered, ddl
FROM `region-{{ var('bq_region') }}`.`INFORMATION_SCHEMA`.`ROUTINE`
FROM `region-{{ var('bq_region') }}`.`INFORMATION_SCHEMA`.`ROUTINES`

{%- endif %}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ models:
name: DDL
type: STRING
description: dataset details with related information
name: routine
name: information_schema_routines
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ models:
name: index_field_path
type: STRING
description: dataset details with related information
name: search_index_columns
name: information_schema_search_index_columns
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,5 @@ models:
name: analyzer
type: STRING
description: dataset details with related information
name: search_indexes
name: information_schema_search_indexes
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ models:
name: user_email
type: STRING
description: dataset details with related information
name: sessions_by_project
name: information_schema_sessions_by_project
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ models:
name: user_email
type: STRING
description: dataset details with related information
name: sessions_by_user
name: information_schema_sessions_by_user
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ models:
name: total_input_bytes
type: INTEGER
description: dataset details with related information
name: streaming_timeline
name: information_schema_streaming_timeline
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ models:
name: total_input_bytes
type: INTEGER
description: dataset details with related information
name: streaming_timeline_by_folder
name: information_schema_streaming_timeline_by_folder
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ models:
name: total_input_bytes
type: INTEGER
description: dataset details with related information
name: streaming_timeline_by_organization
name: information_schema_streaming_timeline_by_organization
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ models:
name: ROUNDING_MODE
type: STRING
description: dataset details with related information
name: column_field_paths
name: information_schema_column_field_paths
version: 2
2 changes: 1 addition & 1 deletion models/base/google/tables/information_schema_columns.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,5 @@ models:
name: ROUNDING_MODE
type: STRING
description: dataset details with related information
name: columns
name: information_schema_columns
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ models:
name: CONSTRAINT_NAME
type: STRING
description: dataset details with related information
name: constraint_column_usage
name: information_schema_constraint_column_usage
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ models:
name: POSITION_IN_UNIQUE_CONSTRAINT
type: INT64
description: dataset details with related information
name: key_column_usage
name: information_schema_key_column_usage
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ models:
name: ENFORCED
type: STRING
description: dataset details with related information
name: table_constraints
name: information_schema_table_constraints
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ models:
name: OPTION_VALUE
type: STRING
description: dataset details with related information
name: table_options
name: information_schema_table_options
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ models:
name: snapshot_time
type: TIMESTAMP
description: dataset details with related information
name: table_snapshots
name: information_schema_table_snapshots
version: 2
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ models:
name: CURRENT_PHYSICAL_BYTES
type: INT64
- description: "Total number of physical (compressed) bytes used for storage,\n\
\ including active, long-term, time travel (deleted or changed data),\
\ and\n fail-safe (deleted or changed data retained after the time-travel\
\ window)\n bytes."
\ including active, long-term, and time travel (deleted or changed data)\n\
\ bytes. Fail-safe (deleted or changed data retained after the time-travel\n\
\ window) bytes aren't included."
name: TOTAL_PHYSICAL_BYTES
type: INT64
- description: "Number of physical (compressed) bytes younger than 90 days,\n \
Expand Down Expand Up @@ -72,5 +72,5 @@ models:
name: FAIL_SAFE_PHYSICAL_BYTES
type: INT64
description: dataset details with related information
name: table_storage
name: information_schema_table_storage
version: 2
Loading

0 comments on commit df2c5af

Please sign in to comment.