From 65641d8b723a88146ef5b034343bdae488cab5ed Mon Sep 17 00:00:00 2001 From: gwen windflower Date: Sat, 9 Mar 2024 15:55:00 -0600 Subject: [PATCH] Ignore build dir --- .gitignore | 1 + build/_sources.yml | 239 ---------------------------- build/stg_customers.sql | 26 --- build/stg_locations.sql | 22 --- build/stg_metricflow_time_spine.sql | 19 --- build/stg_order_items.sql | 27 ---- build/stg_orders.sql | 29 ---- build/stg_products.sql | 25 --- build/stg_raw_customers.sql | 20 --- build/stg_raw_items.sql | 21 --- build/stg_raw_orders.sql | 25 --- build/stg_raw_products.sql | 23 --- build/stg_raw_stores.sql | 22 --- build/stg_raw_supplies.sql | 23 --- build/stg_stg_customers.sql | 20 --- build/stg_stg_locations.sql | 22 --- build/stg_stg_order_items.sql | 21 --- build/stg_stg_orders.sql | 24 --- build/stg_stg_products.sql | 25 --- build/stg_stg_supplies.sql | 24 --- build/stg_supplies.sql | 24 --- main.go | 18 ++- 22 files changed, 17 insertions(+), 683 deletions(-) create mode 100644 .gitignore delete mode 100644 build/_sources.yml delete mode 100644 build/stg_customers.sql delete mode 100644 build/stg_locations.sql delete mode 100644 build/stg_metricflow_time_spine.sql delete mode 100644 build/stg_order_items.sql delete mode 100644 build/stg_orders.sql delete mode 100644 build/stg_products.sql delete mode 100644 build/stg_raw_customers.sql delete mode 100644 build/stg_raw_items.sql delete mode 100644 build/stg_raw_orders.sql delete mode 100644 build/stg_raw_products.sql delete mode 100644 build/stg_raw_stores.sql delete mode 100644 build/stg_raw_supplies.sql delete mode 100644 build/stg_stg_customers.sql delete mode 100644 build/stg_stg_locations.sql delete mode 100644 build/stg_stg_order_items.sql delete mode 100644 build/stg_stg_orders.sql delete mode 100644 build/stg_stg_products.sql delete mode 100644 build/stg_stg_supplies.sql delete mode 100644 build/stg_supplies.sql diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..567609b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/build/_sources.yml b/build/_sources.yml deleted file mode 100644 index 6142e72..0000000 --- a/build/_sources.yml +++ /dev/null @@ -1,239 +0,0 @@ -sources: -- name: RAW_STORES - columns: - - name: TAX_RATE - data_type: FLOAT - - name: NAME - data_type: TEXT - - name: ID - data_type: TEXT - - name: OPENED_AT - data_type: TIMESTAMP_NTZ -- name: RAW_SUPPLIES - columns: - - name: SKU - data_type: TEXT - - name: PERISHABLE - data_type: BOOLEAN - - name: COST - data_type: NUMBER - - name: NAME - data_type: TEXT - - name: ID - data_type: TEXT -- name: STG_ORDERS - columns: - - name: LOCATION_ID - data_type: TEXT - - name: ORDER_TOTAL - data_type: NUMBER - - name: TAX_PAID - data_type: NUMBER - - name: CUSTOMER_ID - data_type: TEXT - - name: ORDERED_AT - data_type: TIMESTAMP_NTZ - - name: ORDER_ID - data_type: TEXT -- name: RAW_ORDERS - columns: - - name: ORDER_TOTAL - data_type: NUMBER - - name: ID - data_type: TEXT - - name: TAX_PAID - data_type: NUMBER - - name: SUBTOTAL - data_type: NUMBER - - name: STORE_ID - data_type: TEXT - - name: ORDERED_AT - data_type: TIMESTAMP_NTZ - - name: CUSTOMER - data_type: TEXT -- name: STG_PRODUCTS - columns: - - name: PRODUCT_DESCRIPTION - data_type: TEXT - - name: PRODUCT_ID - data_type: TEXT - - name: IS_DRINK_ITEM - data_type: BOOLEAN - - name: PRODUCT_TYPE - data_type: TEXT - - name: PRODUCT_PRICE - data_type: NUMBER - - name: IS_FOOD_ITEM - data_type: BOOLEAN - - name: PRODUCT_NAME - data_type: TEXT -- name: ORDER_ITEMS - columns: - - name: IS_DRINK_ITEM - data_type: BOOLEAN - - name: PRODUCT_ID - data_type: TEXT - - name: PRODUCT_PRICE - data_type: NUMBER - - name: ORDER_ID - data_type: TEXT - - name: ORDER_ITEM_ID - data_type: TEXT - - name: ORDERED_AT - data_type: TIMESTAMP_NTZ - - name: PRODUCT_NAME - data_type: TEXT - - name: SUPPLY_COST - data_type: NUMBER - - name: IS_FOOD_ITEM - data_type: BOOLEAN -- name: PRODUCTS - columns: - - name: PRODUCT_NAME - data_type: TEXT - - name: PRODUCT_DESCRIPTION - data_type: TEXT - - name: PRODUCT_TYPE - data_type: TEXT - - name: PRODUCT_ID - data_type: TEXT - - name: PRODUCT_PRICE - data_type: NUMBER - - name: IS_DRINK_ITEM - data_type: BOOLEAN - - name: IS_FOOD_ITEM - data_type: BOOLEAN -- name: RAW_ITEMS - columns: - - name: SKU - data_type: TEXT - - name: ID - data_type: TEXT - - name: ORDER_ID - data_type: TEXT -- name: CUSTOMERS - columns: - - name: CUSTOMER_ID - data_type: TEXT - - name: LAST_ORDERED_AT - data_type: TIMESTAMP_NTZ - - name: CUSTOMER_NAME - data_type: TEXT - - name: LIFETIME_SPEND - data_type: NUMBER - - name: CUSTOMER_TYPE - data_type: TEXT - - name: COUNT_LIFETIME_ORDERS - data_type: NUMBER - - name: LIFETIME_SPEND_PRETAX - data_type: NUMBER - - name: FIRST_ORDERED_AT - data_type: TIMESTAMP_NTZ -- name: LOCATIONS - columns: - - name: TAX_RATE - data_type: FLOAT - - name: LOCATION_ID - data_type: TEXT - - name: OPENED_DATE - data_type: TIMESTAMP_NTZ - - name: LOCATION_NAME - data_type: TEXT -- name: METRICFLOW_TIME_SPINE - columns: - - name: DATE_DAY - data_type: DATE -- name: ORDERS - columns: - - name: ORDER_ID - data_type: TEXT - - name: CUSTOMER_ID - data_type: TEXT - - name: ORDER_COST - data_type: NUMBER - - name: IS_DRINK_ORDER - data_type: BOOLEAN - - name: ORDERED_AT - data_type: TIMESTAMP_NTZ - - name: ORDER_TOTAL - data_type: NUMBER - - name: LOCATION_ID - data_type: TEXT - - name: IS_FOOD_ORDER - data_type: BOOLEAN - - name: COUNT_FOOD_ITEMS - data_type: NUMBER - - name: COUNT_DRINK_ITEMS - data_type: NUMBER - - name: TAX_PAID - data_type: NUMBER -- name: STG_CUSTOMERS - columns: - - name: CUSTOMER_ID - data_type: TEXT - - name: CUSTOMER_NAME - data_type: TEXT -- name: STG_ORDER_ITEMS - columns: - - name: ORDER_ITEM_ID - data_type: TEXT - - name: PRODUCT_ID - data_type: TEXT - - name: ORDER_ID - data_type: TEXT -- name: STG_SUPPLIES - columns: - - name: SUPPLY_UUID - data_type: TEXT - - name: IS_PERISHABLE_SUPPLY - data_type: BOOLEAN - - name: SUPPLY_COST - data_type: NUMBER - - name: SUPPLY_NAME - data_type: TEXT - - name: SUPPLY_ID - data_type: TEXT - - name: PRODUCT_ID - data_type: TEXT -- name: RAW_CUSTOMERS - columns: - - name: ID - data_type: TEXT - - name: NAME - data_type: TEXT -- name: RAW_PRODUCTS - columns: - - name: PRICE - data_type: NUMBER - - name: SKU - data_type: TEXT - - name: DESCRIPTION - data_type: TEXT - - name: TYPE - data_type: TEXT - - name: NAME - data_type: TEXT -- name: STG_LOCATIONS - columns: - - name: OPENED_DATE - data_type: TIMESTAMP_NTZ - - name: TAX_RATE - data_type: FLOAT - - name: LOCATION_NAME - data_type: TEXT - - name: LOCATION_ID - data_type: TEXT -- name: SUPPLIES - columns: - - name: PRODUCT_ID - data_type: TEXT - - name: SUPPLY_UUID - data_type: TEXT - - name: SUPPLY_COST - data_type: NUMBER - - name: SUPPLY_NAME - data_type: TEXT - - name: IS_PERISHABLE_SUPPLY - data_type: BOOLEAN - - name: SUPPLY_ID - data_type: TEXT diff --git a/build/stg_customers.sql b/build/stg_customers.sql deleted file mode 100644 index aa7270f..0000000 --- a/build/stg_customers.sql +++ /dev/null @@ -1,26 +0,0 @@ -with - -source as ( - - select * from {{ ref('CUSTOMERS') }} - -), - -renamed as ( - - select - CUSTOMER_ID as CUSTOMER_ID, - LAST_ORDERED_AT as LAST_ORDERED_AT, - CUSTOMER_NAME as CUSTOMER_NAME, - LIFETIME_SPEND as LIFETIME_SPEND, - CUSTOMER_TYPE as CUSTOMER_TYPE, - COUNT_LIFETIME_ORDERS as COUNT_LIFETIME_ORDERS, - LIFETIME_SPEND_PRETAX as LIFETIME_SPEND_PRETAX, - FIRST_ORDERED_AT as FIRST_ORDERED_AT, - - - from source - -) - -select * from renamed diff --git a/build/stg_locations.sql b/build/stg_locations.sql deleted file mode 100644 index 7ed25ca..0000000 --- a/build/stg_locations.sql +++ /dev/null @@ -1,22 +0,0 @@ -with - -source as ( - - select * from {{ ref('LOCATIONS') }} - -), - -renamed as ( - - select - TAX_RATE as TAX_RATE, - LOCATION_ID as LOCATION_ID, - OPENED_DATE as OPENED_DATE, - LOCATION_NAME as LOCATION_NAME, - - - from source - -) - -select * from renamed diff --git a/build/stg_metricflow_time_spine.sql b/build/stg_metricflow_time_spine.sql deleted file mode 100644 index 871ae4f..0000000 --- a/build/stg_metricflow_time_spine.sql +++ /dev/null @@ -1,19 +0,0 @@ -with - -source as ( - - select * from {{ ref('METRICFLOW_TIME_SPINE') }} - -), - -renamed as ( - - select - DATE_DAY as DATE_DAY, - - - from source - -) - -select * from renamed diff --git a/build/stg_order_items.sql b/build/stg_order_items.sql deleted file mode 100644 index a62ec8c..0000000 --- a/build/stg_order_items.sql +++ /dev/null @@ -1,27 +0,0 @@ -with - -source as ( - - select * from {{ ref('ORDER_ITEMS') }} - -), - -renamed as ( - - select - IS_DRINK_ITEM as IS_DRINK_ITEM, - PRODUCT_ID as PRODUCT_ID, - PRODUCT_PRICE as PRODUCT_PRICE, - ORDER_ID as ORDER_ID, - ORDER_ITEM_ID as ORDER_ITEM_ID, - ORDERED_AT as ORDERED_AT, - PRODUCT_NAME as PRODUCT_NAME, - IS_FOOD_ITEM as IS_FOOD_ITEM, - SUPPLY_COST as SUPPLY_COST, - - - from source - -) - -select * from renamed diff --git a/build/stg_orders.sql b/build/stg_orders.sql deleted file mode 100644 index 163e76a..0000000 --- a/build/stg_orders.sql +++ /dev/null @@ -1,29 +0,0 @@ -with - -source as ( - - select * from {{ ref('ORDERS') }} - -), - -renamed as ( - - select - ORDER_ID as ORDER_ID, - CUSTOMER_ID as CUSTOMER_ID, - ORDER_COST as ORDER_COST, - IS_DRINK_ORDER as IS_DRINK_ORDER, - ORDERED_AT as ORDERED_AT, - ORDER_TOTAL as ORDER_TOTAL, - LOCATION_ID as LOCATION_ID, - IS_FOOD_ORDER as IS_FOOD_ORDER, - COUNT_FOOD_ITEMS as COUNT_FOOD_ITEMS, - COUNT_DRINK_ITEMS as COUNT_DRINK_ITEMS, - TAX_PAID as TAX_PAID, - - - from source - -) - -select * from renamed diff --git a/build/stg_products.sql b/build/stg_products.sql deleted file mode 100644 index 3b1df56..0000000 --- a/build/stg_products.sql +++ /dev/null @@ -1,25 +0,0 @@ -with - -source as ( - - select * from {{ ref('PRODUCTS') }} - -), - -renamed as ( - - select - PRODUCT_NAME as PRODUCT_NAME, - PRODUCT_DESCRIPTION as PRODUCT_DESCRIPTION, - PRODUCT_TYPE as PRODUCT_TYPE, - PRODUCT_PRICE as PRODUCT_PRICE, - PRODUCT_ID as PRODUCT_ID, - IS_FOOD_ITEM as IS_FOOD_ITEM, - IS_DRINK_ITEM as IS_DRINK_ITEM, - - - from source - -) - -select * from renamed diff --git a/build/stg_raw_customers.sql b/build/stg_raw_customers.sql deleted file mode 100644 index 3c26e69..0000000 --- a/build/stg_raw_customers.sql +++ /dev/null @@ -1,20 +0,0 @@ -with - -source as ( - - select * from {{ ref('RAW_CUSTOMERS') }} - -), - -renamed as ( - - select - ID as ID, - NAME as NAME, - - - from source - -) - -select * from renamed diff --git a/build/stg_raw_items.sql b/build/stg_raw_items.sql deleted file mode 100644 index 822453e..0000000 --- a/build/stg_raw_items.sql +++ /dev/null @@ -1,21 +0,0 @@ -with - -source as ( - - select * from {{ ref('RAW_ITEMS') }} - -), - -renamed as ( - - select - SKU as SKU, - ID as ID, - ORDER_ID as ORDER_ID, - - - from source - -) - -select * from renamed diff --git a/build/stg_raw_orders.sql b/build/stg_raw_orders.sql deleted file mode 100644 index a292dcd..0000000 --- a/build/stg_raw_orders.sql +++ /dev/null @@ -1,25 +0,0 @@ -with - -source as ( - - select * from {{ ref('RAW_ORDERS') }} - -), - -renamed as ( - - select - ID as ID, - ORDER_TOTAL as ORDER_TOTAL, - SUBTOTAL as SUBTOTAL, - TAX_PAID as TAX_PAID, - STORE_ID as STORE_ID, - ORDERED_AT as ORDERED_AT, - CUSTOMER as CUSTOMER, - - - from source - -) - -select * from renamed diff --git a/build/stg_raw_products.sql b/build/stg_raw_products.sql deleted file mode 100644 index 528ee23..0000000 --- a/build/stg_raw_products.sql +++ /dev/null @@ -1,23 +0,0 @@ -with - -source as ( - - select * from {{ ref('RAW_PRODUCTS') }} - -), - -renamed as ( - - select - PRICE as PRICE, - SKU as SKU, - DESCRIPTION as DESCRIPTION, - TYPE as TYPE, - NAME as NAME, - - - from source - -) - -select * from renamed diff --git a/build/stg_raw_stores.sql b/build/stg_raw_stores.sql deleted file mode 100644 index 2701397..0000000 --- a/build/stg_raw_stores.sql +++ /dev/null @@ -1,22 +0,0 @@ -with - -source as ( - - select * from {{ ref('RAW_STORES') }} - -), - -renamed as ( - - select - TAX_RATE as TAX_RATE, - NAME as NAME, - ID as ID, - OPENED_AT as OPENED_AT, - - - from source - -) - -select * from renamed diff --git a/build/stg_raw_supplies.sql b/build/stg_raw_supplies.sql deleted file mode 100644 index 5ef8fa8..0000000 --- a/build/stg_raw_supplies.sql +++ /dev/null @@ -1,23 +0,0 @@ -with - -source as ( - - select * from {{ ref('RAW_SUPPLIES') }} - -), - -renamed as ( - - select - SKU as SKU, - PERISHABLE as PERISHABLE, - COST as COST, - NAME as NAME, - ID as ID, - - - from source - -) - -select * from renamed diff --git a/build/stg_stg_customers.sql b/build/stg_stg_customers.sql deleted file mode 100644 index ff779b4..0000000 --- a/build/stg_stg_customers.sql +++ /dev/null @@ -1,20 +0,0 @@ -with - -source as ( - - select * from {{ ref('STG_CUSTOMERS') }} - -), - -renamed as ( - - select - CUSTOMER_ID as CUSTOMER_ID, - CUSTOMER_NAME as CUSTOMER_NAME, - - - from source - -) - -select * from renamed diff --git a/build/stg_stg_locations.sql b/build/stg_stg_locations.sql deleted file mode 100644 index 7fe2347..0000000 --- a/build/stg_stg_locations.sql +++ /dev/null @@ -1,22 +0,0 @@ -with - -source as ( - - select * from {{ ref('STG_LOCATIONS') }} - -), - -renamed as ( - - select - OPENED_DATE as OPENED_DATE, - TAX_RATE as TAX_RATE, - LOCATION_NAME as LOCATION_NAME, - LOCATION_ID as LOCATION_ID, - - - from source - -) - -select * from renamed diff --git a/build/stg_stg_order_items.sql b/build/stg_stg_order_items.sql deleted file mode 100644 index b3dbb7d..0000000 --- a/build/stg_stg_order_items.sql +++ /dev/null @@ -1,21 +0,0 @@ -with - -source as ( - - select * from {{ ref('STG_ORDER_ITEMS') }} - -), - -renamed as ( - - select - ORDER_ITEM_ID as ORDER_ITEM_ID, - PRODUCT_ID as PRODUCT_ID, - ORDER_ID as ORDER_ID, - - - from source - -) - -select * from renamed diff --git a/build/stg_stg_orders.sql b/build/stg_stg_orders.sql deleted file mode 100644 index 12dd9cb..0000000 --- a/build/stg_stg_orders.sql +++ /dev/null @@ -1,24 +0,0 @@ -with - -source as ( - - select * from {{ ref('STG_ORDERS') }} - -), - -renamed as ( - - select - LOCATION_ID as LOCATION_ID, - ORDER_TOTAL as ORDER_TOTAL, - TAX_PAID as TAX_PAID, - CUSTOMER_ID as CUSTOMER_ID, - ORDERED_AT as ORDERED_AT, - ORDER_ID as ORDER_ID, - - - from source - -) - -select * from renamed diff --git a/build/stg_stg_products.sql b/build/stg_stg_products.sql deleted file mode 100644 index 25ce0cd..0000000 --- a/build/stg_stg_products.sql +++ /dev/null @@ -1,25 +0,0 @@ -with - -source as ( - - select * from {{ ref('STG_PRODUCTS') }} - -), - -renamed as ( - - select - PRODUCT_DESCRIPTION as PRODUCT_DESCRIPTION, - PRODUCT_ID as PRODUCT_ID, - PRODUCT_TYPE as PRODUCT_TYPE, - IS_DRINK_ITEM as IS_DRINK_ITEM, - PRODUCT_PRICE as PRODUCT_PRICE, - IS_FOOD_ITEM as IS_FOOD_ITEM, - PRODUCT_NAME as PRODUCT_NAME, - - - from source - -) - -select * from renamed diff --git a/build/stg_stg_supplies.sql b/build/stg_stg_supplies.sql deleted file mode 100644 index aa730b8..0000000 --- a/build/stg_stg_supplies.sql +++ /dev/null @@ -1,24 +0,0 @@ -with - -source as ( - - select * from {{ ref('STG_SUPPLIES') }} - -), - -renamed as ( - - select - SUPPLY_NAME as SUPPLY_NAME, - SUPPLY_UUID as SUPPLY_UUID, - IS_PERISHABLE_SUPPLY as IS_PERISHABLE_SUPPLY, - SUPPLY_COST as SUPPLY_COST, - SUPPLY_ID as SUPPLY_ID, - PRODUCT_ID as PRODUCT_ID, - - - from source - -) - -select * from renamed diff --git a/build/stg_supplies.sql b/build/stg_supplies.sql deleted file mode 100644 index e2c56a9..0000000 --- a/build/stg_supplies.sql +++ /dev/null @@ -1,24 +0,0 @@ -with - -source as ( - - select * from {{ ref('SUPPLIES') }} - -), - -renamed as ( - - select - PRODUCT_ID as PRODUCT_ID, - SUPPLY_COST as SUPPLY_COST, - SUPPLY_UUID as SUPPLY_UUID, - SUPPLY_NAME as SUPPLY_NAME, - IS_PERISHABLE_SUPPLY as IS_PERISHABLE_SUPPLY, - SUPPLY_ID as SUPPLY_ID, - - - from source - -) - -select * from renamed diff --git a/main.go b/main.go index b8983db..c4ddc68 100644 --- a/main.go +++ b/main.go @@ -35,6 +35,19 @@ type SourceTables struct { func main() { form := huh.NewForm( + huh.NewGroup( + huh.NewNote(). + Title("Welcome to tbd!🏎️✨"). + Description(`A fast and friendly code generator for dbt. +We will generate sources YAML config and SQL staging models for all the tables in the schema you specify. +To prepare, make sure you have the following: +✴︎ *_Username_* (e.g. aragorn@dunedain.king) +✴︎ *_Account ID_* (e.g. elfstone-consulting.us-west-1) +✴︎ *_Schema_* you want to generate (e.g. minas-tirith) +✴︎ *_Database_* that schema is in (e.g. gondor) +Authentication will be handled via SSO in the web browser. +For security, we don't currently support password-based authentication.`), + ), huh.NewGroup( huh.NewSelect[string](). Title("Choose your warehouse."). @@ -58,9 +71,10 @@ func main() { huh.NewInput(). Title("What database is that schema in?"). Value(&dbDatabase), - + ), + huh.NewGroup( huh.NewConfirm(). - Title("Are you ready to proceed?"). + Title("Are you ready to go?"). Value(&confirm), ), )