-
Notifications
You must be signed in to change notification settings - Fork 504
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
281 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
|
||
# ClickHouse Table Naming Conventions | ||
|
||
This document outlines the naming conventions for tables and materialized views in our ClickHouse setup. Adhering to these conventions ensures consistency, clarity, and ease of management across our data infrastructure. | ||
|
||
## General Rules | ||
|
||
1. Use lowercase letters and separate words with underscores. | ||
2. Avoid ClickHouse reserved words and special characters in names. | ||
3. Be descriptive but concise. | ||
|
||
## Table Naming Convention | ||
|
||
Format: `[prefix]_[domain]_[description]_[version]` | ||
|
||
### Prefixes | ||
|
||
- `raw_`: Input data tables | ||
- `mv_`: Materialized views | ||
- `tmp_{yourname}_`: Temporary tables for experiments, add your name, so it's easy to identify ownership. | ||
|
||
### Domain/Category | ||
|
||
Include the domain or category of the data when applicable. | ||
|
||
Examples: | ||
- `keys` | ||
- `audit` | ||
- `user` | ||
- `gateway` | ||
|
||
### Versioning | ||
|
||
- Version numbers: `_v1`, `_v2`, etc. | ||
|
||
### Aggregation Suffixes | ||
|
||
For aggregated or summary tables, use suffixes like: | ||
- `_daily` | ||
- `_monthly` | ||
- `_summary` | ||
|
||
## Materialized View Naming Convention | ||
|
||
Format: `mv_[description]_[aggregation]` | ||
|
||
- Always prefix with `mv_` | ||
- Include a description of the view's purpose | ||
- Add aggregation level if applicable | ||
|
||
## Examples | ||
|
||
1. Raw Data Table: | ||
`raw_sales_transactions_v1` | ||
|
||
2. Materialized View: | ||
`mv_active_users_daily_v2` | ||
|
||
3. Temporary Table: | ||
`tmp_andreas_user_analysis_v1` | ||
|
||
4. Aggregated Table: | ||
`mv_sales_summary_daily_v1` | ||
|
||
## Consistency Across Related Objects | ||
|
||
Maintain consistent naming across related tables, views, and other objects: | ||
|
||
- `raw_user_activity_v1` | ||
- `mv_user_activity_daily_v1` | ||
|
||
By following these conventions, we ensure a clear, consistent, and scalable naming structure for our ClickHouse setup. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
apps/agent/pkg/clickhouse/schema/002_create_key_verifications_table.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
-- +goose up | ||
CREATE TABLE default.raw_key_verifications_v1( | ||
-- the api request id, so we can correlate the verification with traces and logs | ||
request_id String, | ||
|
||
-- unix milli | ||
time Int64, | ||
|
||
workspace_id String, | ||
key_space_id String, | ||
key_id String, | ||
|
||
-- Right now this is a 3 character airport code, but when we move to aws, | ||
-- this will be the region code such as `us-east-1` | ||
region String, | ||
|
||
-- Examples: | ||
-- - "VALID" | ||
-- - "RATE_LIMITED" | ||
-- - "EXPIRED" | ||
-- - "DISABLED | ||
outcome LowCardinality(String), | ||
|
||
-- Empty string if the key has no identity | ||
identity_id String, | ||
|
||
) | ||
ENGINE = MergeTree() | ||
ORDER BY (workspace_id, key_space_id, key_id, time) | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
972f46b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
planetfall – ./apps/planetfall
planetfall-two.vercel.app
planetfall-git-main-unkey.vercel.app
planetfall-unkey.vercel.app
planetfall.unkey.dev