Skip to content

Seipcs Candyland Candy 2017

s3://trase-storage/candyland/candy/sei_pcs/v1.0.0/SEIPCS_CANDYLAND_CANDY_2017.csv

Dbt path: trase_production.main.seipcs_candyland_candy_2017

Explore on Metabase: Full table; summary statistics

Containing yaml file link: trase/data_pipeline/models/candyland/candy/sei_pcs/v1_0_0/_schema.yml

Model file link: trase/data_pipeline/models/candyland/candy/sei_pcs/v1_0_0/seipcs_candyland_candy_2017.py

Calls script: trase/models/candyland/candy

Dbt test runs & lineage: Test results ยท Lineage

Full dbt_docs page: Open in dbt docs (includes lineage graph -at the bottom right-, tests, and downstream dependencies)

Tags: mock_model, candy, candyland, sei_pcs, v1.0.0


seipcs_candyland_candy_2017

Description

This model was auto-generated based off .yml 'lineage' files in S3. The DBT model just raises an error; the actual script that created the data lives elsewhere. The script is located at trase/models/candyland/candy [permalink]. It was last run by Harry Biddle.


Details

Column Type Description
COUNTRY_OF_ORIGIN VARCHAR
MUNICIPALITY_TRASE_ID_PROD VARCHAR
PORT_OF_EXPORT VARCHAR
EXPORTER VARCHAR
EXPORTER_TAX_ID BIGINT
IMPORTER VARCHAR
COMPANY VARCHAR
COUNTRY_OF_DESTINATION VARCHAR
VOLUME_RAW DOUBLE
FOB DOUBLE
HS6 VARCHAR
YEAR BIGINT
LEVEL BIGINT
STORAGE BIGINT
BRANCH VARCHAR
TERRITORIAL_DEFORESTATION DOUBLE
STATUS VARCHAR

Models / Seeds

  • source.trase_duckdb.trase-storage-raw.candyland_assets
  • source.trase_duckdb.trase-storage-raw.candyland_cost_matrix
  • source.trase_duckdb.trase-storage-raw.candyland_customs_records_2017
  • source.trase_duckdb.trase-storage-raw.candyland_municipalities
  • source.trase_duckdb.trase-storage-raw.candyland_production_2017

Sources

  • ['trase-storage-raw', 'candyland_assets']
  • ['trase-storage-raw', 'candyland_cost_matrix']
  • ['trase-storage-raw', 'candyland_customs_records_2017']
  • ['trase-storage-raw', 'candyland_municipalities']
  • ['trase-storage-raw', 'candyland_production_2017']

No called script or script source not found.

from unittest.mock import patch

from trase.tools.etl.processors import Preprocessor
from trase.tools.sei_pcs.supply_chain import SupplyChain


def model(dbt, cursor):
    dbt.config(materialized="external")

    # provide the SupplyChain class with data from DBT rather than allowing it to
    # read from trase/models/candyland/candy/data. The keys in the dictionary relate to
    # the "outname" properties in trase/models/candyland/candy/preparation.py
    data = {
        # fmt: off
        "asset": dbt.source("trase-storage-raw", "candyland_assets").df(),
        "cost": dbt.source("trase-storage-raw", "candyland_cost_matrix").df(),
        "flows": dbt.source("trase-storage-raw", "candyland_customs_records_2017").df(),
        "municipality": dbt.source("trase-storage-raw", "candyland_municipalities").df(),
        "production": dbt.source("trase-storage-raw", "candyland_production_2017").df(),
    }

    supply_chain = SupplyChain("candyland/candy", 2017, pre_extracted_data=data)

    with patch.object(
        Preprocessor,
        "extract",
        side_effect=RuntimeError("Preparation class should not be reading from disk"),
    ):
        supply_chain.preparation()

    supply_chain.load()
    supply_chain.run()

    return supply_chain.df_export()