Skip to content

Commit 5972457

Browse files
committed
Added schema query for Snowflake
1 parent 3a25276 commit 5972457

1 file changed

Lines changed: 21 additions & 4 deletions

File tree

README.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,30 @@ JOIN %PROJECT_NAME%.%DATASET_NAME%.INFORMATION_SCHEMA.TABLES t
111111
AND c.table_name = t.table_name
112112
WHERE
113113
c.table_schema NOT IN ('INFORMATION_SCHEMA')
114-
ORDER BY
115-
c.table_schema,
116-
c.table_name,
117-
c.ordinal_position;
114+
ORDER BY 1, 2, 5
118115
```
119116

120117
:mag: Make sure to replace `%PROJECT_NAME%.%DATASET_NAME%` with proper values.
121118

119+
#### Snowflake
120+
121+
```sql
122+
SELECT
123+
c.table_schema,
124+
c.table_name,
125+
c.column_name,
126+
c.data_type,
127+
c.ordinal_position
128+
FROM information_schema.columns c
129+
JOIN information_schema.tables t
130+
ON c.table_schema = t.table_schema
131+
AND c.table_name = t.table_name
132+
WHERE
133+
c.table_schema NOT IN ('INFORMATION_SCHEMA')
134+
AND t.table_type = 'BASE TABLE'
135+
ORDER BY 1, 2, 5
136+
```
137+
122138
#### MySQL
123139

124140
```sql
@@ -135,6 +151,7 @@ LEFT JOIN information_schema.views v
135151
WHERE
136152
c.table_schema NOT IN ('sys','information_schema', 'mysql', 'performance_schema')
137153
AND c.table_name NOT IN ('schema_migrations', 'ar_internal_metadata')
154+
ORDER BY 1, 2, 5
138155
```
139156

140157
#### [SAP ASE](https://github.com/sqlhabit/sql_schema_visualizer/issues/8)

0 commit comments

Comments
 (0)