Ingest
Ingest
The ingest command is used to bootstrap models directly out of a database. This is typically the first step in setting up trilogy in a new environment or a new table.
It supports a list of tables to create - comma separated - as well as an optional --fks relationship mapping.
Arguments:
@argument("tables", type=str)
@argument("dialect", type=str, required=False)
@option("--output", "-o", type=Path(), help="Output path for generated scripts")
@option("--schema", "-s", type=str, help="Schema/database to ingest from")
@option(
"--config", type=Path(exists=True), help="Path to trilogy.toml configuration file"
)
@option(
"--fks",
type=str,
help="Foreign key relationships in format: table.column:ref_table.column (comma-separated)",
)
@argument("conn_args", nargs=-1, type=UNPROCESSED)
Full Example
This would bootstrap a tpc_ds data model to the default directory, connecting all the relevant dimensions.
trilogy ingest store_sales,date_dim,time_dim,item,customer,customer_demographics,household_demographics,customer_address,store,promotion --fks=store_sales.ss_sold_date_sk:date_dim.d_date_sk,store_sales.ss_sold_time_sk:time_dim.t_time_sk,store_sales.ss_item_sk:item.i_item_sk,store_sales.ss_customer_sk:customer.c_customer_sk,store_sales.ss_cdemo_sk:customer_demographics.cd_demo_sk,store_sales.ss_hdemo_sk:household_demographics.hd_demo_sk,store_sales.ss_addr_sk:customer_address.ca_address_sk,store_sales.ss_store_sk:store.s_store_sk,store_sales.ss_promo_sk:promotion.p_promo_sk
