In Snowflake, think of the hierarchy as:
- Database: The highest-level container, like a filing cabinet
- Schema: Folders within that cabinet to organize related objects
- Tables: Individual files within those folders containing your actual data
For your marketing data scenario with Google Ads and Meta Ads, here's a practical approach:
Database Level
Create a database for your marketing analytics, something like MARKETING_DB or ANALYTICS_DB. This keeps all your marketing data logically separated from other business domains.
Schema Level
You have several options depending on your needs:
-
By Source System: Create schemas like GOOGLE_ADS and META_ADS. Each Snowpipe would load data into tables within its respective schema. This makes it clear where data originated and simplifies permissions management.
-
By Data Layer: Use schemas like RAW, STAGING, and ANALYTICS:
RAW: Where your Snowpipes dump unprocessed data
STAGING: For cleaned/transformed data
ANALYTICS: For final tables/views that users query
-
Hybrid Approach: Combine both patterns with schemas like RAW_GOOGLE_ADS, RAW_META_ADS, then ANALYTICS_MARKETING for processed data.
Table Level
Within each schema, organize tables by the type of data they contain. For example, in a GOOGLE_ADS schema:
CAMPAIGNS
AD_GROUPS
KEYWORDS
PERFORMANCE_DAILY
Since you're using Snowpipes, consider having your pipes load into "raw" or "landing" tables first, then use tasks or dbt to transform that data into more refined analytical tables. This gives you a clear data lineage and makes debugging easier.
The key is consistency - whatever pattern you choose, stick with it across all your data sources to make the system intuitive for anyone who needs to work with it.