Skip to content

Kivayan/sql-copilot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sql-copilot

Install sqlfluff

uv tool install sqlfluff

Install sqlcmd

winget install sqlcmd

uv tool install --from "markitdown[all]" markitdown uv tool install --from "sqlfluff" sqlfluff

Login to db using azcli

az login

Run queries using sqlcmd:

sqlcmd `
    --authentication-method ActiveDirectoryDefault `
    -S sql-aisql.database.windows.net -d sqldb-aisql `
    -Q "SELECT TOP 5 * FROM SalesLT.Product"

run file as query:

sqlcmd `
    --authentication-method ActiveDirectoryDefault `
    -S sql-aisql.database.windows.net -d sqldb-aisql `
    -i select.sql

Gold Layer (Power BI Star Schema)

Scripts are in sql/gold and are ordered for first-time deployment.

Deploy all gold objects:

sqlcmd `
    --authentication-method ActiveDirectoryDefault `
    -S sql-aisql.database.windows.net -d sqldb-aisql `
    -i sql/gold/00_deploy_gold.sql

Run load orchestration:

sqlcmd `
    --authentication-method ActiveDirectoryDefault `
    -S sql-aisql.database.windows.net -d sqldb-aisql `
    -Q "EXEC gold.uspLoadGoldSalesLT @StartDate = '2000-01-01', @EndDate = '2035-12-31';"

Individual scripts in execution order:

  1. sql/gold/01_create_schema_gold.sql
  2. sql/gold/10_create_dimensions.sql
  3. sql/gold/20_create_facts.sql
  4. sql/gold/30_create_dim_load_procs.sql
  5. sql/gold/40_create_fact_load_procs.sql
  6. sql/gold/50_create_orchestration_proc.sql

Raw HubSpot Contacts Landing Table

Create the raw table used to ingest flattened contact records from HubSpot contacts API responses:

sqlcmd `
    --authentication-method ActiveDirectoryDefault `
    -S sql-aisql.database.windows.net -d sqldb-aisql `
    -i sql/raw/10_create_hubspot_contacts_raw.sql

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages