Skip to content

DBT: Gold Uganda Coffee 2020

File location: s3://trase-storage/uganda/trade/bol/2020/gold/gold_uganda_coffee_2020.parquet

DBT model name: gold_uganda_coffee_2020

Explore on Metabase: Full table; summary statistics

Explore dependencies/lineage: link

Heads up — this asset has failing data tests

1 warn. See the Data Tests tab below.


Description

.

Auto-generated docs for 'gold_uganda_coffee_2020'

Date this documentation was generated: 2024-12-16 20:03 CET

Basic S3 Information

  • S3 Location: s3://trase-storage/uganda/trade/bol/2020/gold/gold_uganda_coffee_2020.parquet
  • File Size: 0.13 MB
  • Last Updated: 2024-10-07 12:39:07+00:00
  • S3 Version Id: JRnyntWVUIoGwHttMRs4jEW.L0BlQC_n

Explore data in Metabase

Data Profile

column_name column_type min max approx_unique avg std q25 q50 q75 count null_percentage
year INTEGER 2020 2020 1 2020 0 2020 2020 2020 7326 0
exporter_label VARCHAR 32 CUP ZOEGAS KAFFEE,GRENADJARGATAN 6 559 7326 0
exporter_group_name VARCHAR 32 CUP ZOEGAS KAFFEE,GRENADJARGATAN 6 280 7326 0
country_of_destination VARCHAR ALBANIA YUGOSLAV SFR 41 7326 0
mass_tonnes DOUBLE 0.025 357.0 853 38.1558 32.9518 19.2584 21.6 42.2974 7326 0
fob DOUBLE 2.1169 5489303.566 4345 28829.3 81726.7 150.756 971.353 37616.9 7326 0
importer_label VARCHAR "ORIMI UKRAINE" LLC ZUKUKA BORA COFFEE COMPANY 1408 7326 0.08
port_of_export_label VARCHAR 0 7326 100
hs6 VARCHAR 090111 090111 1 7326 0

DBT Tests

To see detailed documentation of each test, go further below to the Referenced by -> Data Tests section

Compiled filename Link to run manually Number of records returned or failed
check_trader_groups_gold_ugand_fbf8c4611933e92e4035a0c9c61010ed.sql Metabase link 0
check_bol_against_comtrade_gol_ca9139e47370465bc6612403b9eed166.sql Metabase link 1
relationships_gold_uganda_coff_dca736c188b86878c3e469eef928d809.sql Metabase link 0
dbt_utils_expression_is_true_g_8aed8f0eea3cf7a7c4310c2b4263ce2d.sql Metabase link 0
accepted_values_gold_uganda_co_7a6ae4879fc6411323f36f3ea3c106bf.sql Metabase link 0
dbt_utils_expression_is_true_gold_uganda_coffee_2020_fob___0.sql Metabase link 0
not_null_gold_uganda_coffee_2020_fob.sql Metabase link 0
not_null_gold_uganda_coffee_2020_mass_tonnes.sql Metabase link 0
not_null_gold_uganda_coffee_2020_hs6.sql Metabase link 0

Details

Column Type Description
year INTEGER
exporter_label VARCHAR
exporter_node_id DOUBLE
exporter_group_name VARCHAR
country_of_destination VARCHAR
mass_tonnes DOUBLE
fob DOUBLE
importer_label VARCHAR
port_of_export_label VARCHAR
hs6 VARCHAR

Review full report including sample errors records if they exist (link)

Test column Test name Failing rows Last test run Last status Query in Metabase
Whole table test check_bol_against_comtrade_gold_uganda_coffee_2020_UGA__0901_2101__mass_tonnes__2020 15 2026-07-07 15:08 warn 🔍 run query
Whole table test check_trader_groups_gold_uganda_coffee_2020_exporter_group_name__2020 2026-07-07 15:09 pass 🔍 run query
country_of_destination relationships_gold_uganda_coffee_2020_country_of_destination__country_name__ref_postgres_countries_ 2026-07-07 15:14 pass 🔍 run query
fob dbt_utils_expression_is_true_gold_uganda_coffee_2020_fob___0 2026-07-07 15:10 pass 🔍 run query
fob not_null_gold_uganda_coffee_2020_fob 2026-07-07 15:13 pass 🔍 run query
hs6 accepted_values_gold_uganda_coffee_2020_hs6 2026-07-07 15:07 pass 🔍 run query
hs6 not_null_gold_uganda_coffee_2020_hs6 2026-07-07 15:13 pass 🔍 run query
mass_tonnes dbt_utils_expression_is_true_gold_uganda_coffee_2020_mass_tonnes___0 2026-07-07 15:10 pass 🔍 run query
mass_tonnes not_null_gold_uganda_coffee_2020_mass_tonnes 2026-07-07 15:13 pass 🔍 run query

Models

No called script or script source not found.

# gold_uganda_coffee_2020
from trase.data.uganda.gold_uganda_coffee_2020 import get_gold_uganda_coffee_2020


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

    # Declaring the sources so they appear in the documentation / lineage
    silver_trade_data = dbt.ref("silver_uganda_coffee_2020")

    df = get_gold_uganda_coffee_2020()

    final_data = session.sql(
        f"""
        WITH final_fields AS (
            SELECT
                YEAR::INT AS year,
                EXPORTER_NAME AS exporter_label,
                EXPORTER_ID AS exporter_node_id,
                EXPORTER_GROUP AS exporter_group_name,
                COUNTRY_DESTINATION AS country_of_destination,
                NET_WEIGHT/1000 AS mass_tonnes,
                CIF_VALUE_AMT_USD AS fob,
                BUYER_NAME AS importer_label,
                NULL::VARCHAR AS port_of_export_label,
                CAST(HS_CODE[0:6] AS VARCHAR) AS hs6
            FROM df
            WHERE
                (HS6 LIKE '0901%' OR HS6 LIKE '2101%')
        )
        SELECT * FROM final_fields    
    """
    ).arrow()

    return final_data