-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmetadata.sql
More file actions
35 lines (31 loc) · 1.06 KB
/
metadata.sql
File metadata and controls
35 lines (31 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
-- Create the metadata database (Run this in your DBMS)
CREATE DATABASE metadata_db;
-- Use the metadata database (For postgres)
USE metadata_db;
--Source Metadata Table
CREATE TABLE metadata_source (
id SERIAL PRIMARY KEY,
source_db_type VARCHAR(50), -- PostgreSQL, MySQL, SQL Server
source_db_host VARCHAR(255),
source_db_port INTEGER,
source_db_name VARCHAR(255),
source_table_name VARCHAR(255),
source_column_name VARCHAR(255),
transformation_rule VARCHAR(255)
);
--Target Metadata Table
CREATE TABLE metadata_target (
id SERIAL PRIMARY KEY,
target_db_type VARCHAR(50), -- Snowflake, PostgreSQL, MySQL
target_db_host VARCHAR(255),
target_db_port INTEGER,
target_db_name VARCHAR(255),
target_table_name VARCHAR(255),
target_column_name VARCHAR(255)
);
-- Transformation Metadata Table
CREATE TABLE metadata_transformations (
id SERIAL PRIMARY KEY,
source_column_name VARCHAR(255),
transformation_rule VARCHAR(255) -- e.g., "uppercase", "mask_email", "convert_date"
);