Skip to content

Bronze Brazil Bol Coffee 2020

s3://trase-storage/brazil/coffee/trade/2020/bronze/bronze_brazil_bol_coffee_2020.parquet

Dbt path: trase_production.main_brazil_coffee.bronze_brazil_bol_coffee_2020

Explore on Metabase: Full table; summary statistics

Containing yaml file link: trase/data_pipeline/models/brazil/coffee/trade/_schema_brazil_coffee.yml

Model file link: trase/data_pipeline/models/brazil/coffee/trade/bronze_brazil_bol_coffee_2020.sql

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: bronze, brazil, coffee, trade, bol, 2020, diet-trase-coffee


bronze_brazil_bol_coffee_2020

Description

Filters the Brazil BOL data for coffee products (HS6 0901%) and adjusts field names. Takes data from the source: brazil_trade > silver_brazil_bol_2020


Details

Column Type Description
HS6 VARCHAR
COUNTRY_OF_ORIGIN_LABEL VARCHAR
EXPORTER_CNPJ VARCHAR
EXPORTER_LABEL VARCHAR
PORT_OF_EXPORT_LABEL VARCHAR
PORT_OF_IMPORT_LABEL VARCHAR
COUNTRY_OF_DESTINATION_LABEL VARCHAR
IMPORTER_CITY VARCHAR
IMPORTER_LABEL VARCHAR
IMPORTER_COUNTRY_LABEL VARCHAR
IMPORTER_CODE VARCHAR
VOL DOUBLE
HS4 VARCHAR
HS5 VARCHAR
YEAR INTEGER
MONTH INTEGER
DAY INTEGER
EXPORTER_STATE_NAME VARCHAR
EXPORTER_STATE_TRASE_ID VARCHAR
EXPORTER_MUNICIPALITY_NAME VARCHAR
EXPORTER_MUNICIPALITY_TRASE_ID VARCHAR
COUNTRY_OF_DESTINATION_NAME VARCHAR
COUNTRY_OF_DESTINATION_TRASE_ID VARCHAR
PORT_OF_EXPORT_NAME VARCHAR
EXPORTER_TYPE VARCHAR

Models / Seeds

  • model.trase_duckdb.brazil_bol_2020

No called script or script source not found.

{{ 
    config(materialized='external') 
}}
WITH source_data AS (
    SELECT
        "hs6"::STRING AS HS6,
        "country_of_origin.label" AS COUNTRY_OF_ORIGIN_LABEL,
        "exporter.cnpj" AS EXPORTER_CNPJ,
        "exporter.label" AS EXPORTER_LABEL,
        "port_of_export.label" AS PORT_OF_EXPORT_LABEL,
        "port_of_import.label" AS PORT_OF_IMPORT_LABEL,
        "country_of_destination.label" AS COUNTRY_OF_DESTINATION_LABEL,
        "importer.city" AS IMPORTER_CITY,
        "importer.label" AS IMPORTER_LABEL,
        "importer.country.label" AS IMPORTER_COUNTRY_LABEL,
        "importer.code" AS IMPORTER_CODE,
        "vol"::DOUBLE AS VOL,
        "hs4" AS HS4,
        "hs5" AS HS5,
        "year"::INT AS YEAR,
        "month"::INT AS MONTH,
        "day"::INT AS DAY,
        "exporter.state.name" AS EXPORTER_STATE_NAME,
        "exporter.state.trase_id" AS EXPORTER_STATE_TRASE_ID,
        "exporter.municipality.name" AS EXPORTER_MUNICIPALITY_NAME,
        "exporter.municipality.trase_id" AS EXPORTER_MUNICIPALITY_TRASE_ID,
        "country_of_destination.name" AS COUNTRY_OF_DESTINATION_NAME,
        "country_of_destination.trase_id" AS COUNTRY_OF_DESTINATION_TRASE_ID,
        "port_of_export.name" AS PORT_OF_EXPORT_NAME,
        "exporter.type" AS EXPORTER_TYPE
    FROM
        {{ ref('brazil_bol_2020') }}
    WHERE
        HS6 LIKE '0901%'
    OR
        HS6 LIKE '21011%'
)

SELECT * FROM source_data