1
1
core :
2
2
drop_table : drop table if exists {table}
3
3
drop_view : drop view if exists {view}
4
+ drop_index : drop index if exists {index}
5
+ create_index : create index {index} on {table} ({cols})
6
+ create_unique_index : create unique index {index} on {table} ({cols})
4
7
create_table : create table if not exists {table} ({col_types})
8
+ create_temporary_table : create temp table if not exists {table} ({col_types})
5
9
replace : replace into {table} ({names}) values({values})
6
10
truncate_table : delete from {table}
7
11
insert_option : " "
8
12
modify_column : ' alter {column} type {type}'
9
13
10
- iceberg_scan : select {fields} from iceberg_scan('{uri}', allow_moved_paths = true) {where}
11
- delta_scan : select {fields} from delta_scan('{uri}') {where}
12
- parquet_scan : select {fields} from parquet_scan('{uri}') {where}
13
-
14
14
15
15
metadata :
16
16
databases : PRAGMA database_list
17
17
18
18
current_database : PRAGMA database_list
19
19
20
20
schemas : |
21
- select schema_name
21
+ select distinct schema_name
22
22
from information_schema.schemata
23
23
order by schema_name
24
24
@@ -40,22 +40,25 @@ metadata:
40
40
columns : |
41
41
select column_name, data_type, coalesce(numeric_precision, character_maximum_length) as precision, numeric_scale as scale
42
42
from information_schema.columns
43
- where table_name = '{table}'
43
+ where table_schema = '{schema}'
44
+ and table_name = '{table}'
44
45
order by ordinal_position
45
46
46
47
primary_keys : |
47
48
select '{table}.key' as pk_name,
48
49
constraint_index as position,
49
50
replace(replace(constraint_text, 'PRIMARY KEY(', ''), ')', '') as column_name
50
51
from duckdb_constraints()
51
- where table_name = '{table}'
52
+ where table_schema = '{schema}'
53
+ and table_name = '{table}'
52
54
and constraint_type = 'PRIMARY KEY'
53
55
54
56
indexes : |
55
57
select index_name as index_name,
56
58
sql as column_name
57
59
from duckdb_indexes()
58
- where table_name = '{table}'
60
+ where table_schema = '{schema}'
61
+ and table_name = '{table}'
59
62
60
63
columns_full : |
61
64
with tables_cte as (
@@ -69,7 +72,8 @@ metadata:
69
72
else false
70
73
end as is_view
71
74
from information_schema.tables
72
- where table_name = '{table}'
75
+ where table_schema = '{schema}'
76
+ and table_name = '{table}'
73
77
)
74
78
select
75
79
cols.table_schema as schema_name,
@@ -95,6 +99,7 @@ metadata:
95
99
end as is_view
96
100
from information_schema.tables
97
101
where 1=1
102
+ {{if .schema -}} and table_schema = '{schema}' {{- end}}
98
103
{{if .tables -}} and table_name in ({tables}) {{- end}}
99
104
)
100
105
select
@@ -111,10 +116,10 @@ metadata:
111
116
order by cols.table_catalog, cols.table_schema, cols.table_name, cols.ordinal_position
112
117
113
118
ddl_table : |
114
- PRAGMA table_info('{table}')
119
+ PRAGMA table_info('{schema}.{ table}')
115
120
116
121
ddl_view : |
117
- PRAGMA table_info('{table}')
122
+ PRAGMA table_info('{schema}.{ table}')
118
123
119
124
analysis :
120
125
chars : |
@@ -142,6 +147,7 @@ function:
142
147
checksum_datetime : CAST((epoch({field}) || substr(strftime({field}, '%f'),4) ) as bigint)
143
148
checksum_decimal : ' abs(cast({field} as bigint))'
144
149
checksum_boolean : ' length({field}::string)'
150
+ cast_to_text : ' cast({field} as text)'
145
151
146
152
variable :
147
153
bool_as : integer
0 commit comments