I'm using the dataform on the GCP console. I've created a definitions/sources/declaration.js
file where I call the built-in js function declare()
to reference tables on other BigQuery projects. Is there a way of defining an alias to a table declaration that could be used as reference on the ref
function in the .sqlx files (instead of hard coding the table name)? Ex:
// definitions/sources/declaration.js
declare({
database: <table_database>,
schema: <table_schema>,
name: <table_name>,
alias: <declaration_alias_name>
})
// definitions/tables_creation/final_table01.sqlx
select
*
from ${ref("<declaration_alias_name>")}
This would be useful if a table_name
changed, because it would be necessary to change only the declaration file and not all the .sqlx that use that reference.
A way extract and save the table_name
of a declaration to a variable would also work.