Skip to content

Commit

Permalink
Merge pull request #1971 from taozhi8833998/feat-snowflake
Browse files Browse the repository at this point in the history
Feat snowflake
  • Loading branch information
taozhi8833998 authored Jun 20, 2024
2 parents 60e9fc0 + 31820b8 commit 444acd5
Show file tree
Hide file tree
Showing 16 changed files with 126 additions and 132 deletions.
11 changes: 6 additions & 5 deletions pegjs/athena.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -285,18 +285,19 @@ if_not_exists_stmt

create_db_stmt
= a:KW_CREATE __
k:(KW_DATABASE / KW_SCHEME) __
k:(KW_DATABASE / KW_SCHEMA) __
ife:if_not_exists_stmt? __
t:ident_without_kw_type __
t:proc_func_name __
c:create_db_definition? {
const keyword = k.toLowerCase()
return {
tableList: Array.from(tableList),
columnList: columnListTableAlias(columnList),
ast: {
type: a[0].toLowerCase(),
keyword: 'database',
keyword,
if_not_exists:ife,
database: t,
[keyword]: { db: t.schema, schema: t.name },
create_definitions: c,
}
}
Expand Down Expand Up @@ -2305,7 +2306,7 @@ KW_AS = "AS"i !ident_start
KW_TABLE = "TABLE"i !ident_start { return 'TABLE'; }
KW_TABLES = "TABLES"i !ident_start { return 'TABLES'; }
KW_DATABASE = "DATABASE"i !ident_start { return 'DATABASE'; }
KW_SCHEME = "SCHEME"i !ident_start { return 'SCHEME'; }
KW_SCHEMA = "SCHEMA"i !ident_start { return 'SCHEMA'; }
KW_COLLATE = "COLLATE"i !ident_start { return 'COLLATE'; }

KW_ON = "ON"i !ident_start
Expand Down
7 changes: 4 additions & 3 deletions pegjs/bigquery.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -904,16 +904,17 @@ create_db_stmt
= a:KW_CREATE __
k:(KW_DATABASE / KW_SCHEMA) __
ife:if_not_exists_stmt? __
t:ident_without_kw_type __
t:proc_func_name __
c:create_db_definition? {
const keyword = k.toLowerCase()
return {
tableList: Array.from(tableList),
columnList: columnListTableAlias(columnList),
ast: {
type: a[0].toLowerCase(),
keyword: 'database',
keyword,
if_not_exists:ife,
database: t,
[keyword]: { db: t.schema, schema: t.name },
create_definitions: c,
}
}
Expand Down
11 changes: 6 additions & 5 deletions pegjs/db2.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -284,18 +284,19 @@ if_not_exists_stmt

create_db_stmt
= a:KW_CREATE __
k:(KW_DATABASE / KW_SCHEME) __
k:(KW_DATABASE / KW_SCHEMA) __
ife:if_not_exists_stmt? __
t:ident_without_kw_type __
t:proc_func_name __
c:create_db_definition? {
const keyword = k.toLowerCase()
return {
tableList: Array.from(tableList),
columnList: columnListTableAlias(columnList),
ast: {
type: a[0].toLowerCase(),
keyword: 'database',
keyword,
if_not_exists:ife,
database: t,
[keyword]: { db: t.schema, schema: t.name },
create_definitions: c,
}
}
Expand Down Expand Up @@ -2277,7 +2278,7 @@ KW_AS = "AS"i !ident_start
KW_TABLE = "TABLE"i !ident_start { return 'TABLE'; }
KW_TABLES = "TABLES"i !ident_start { return 'TABLES'; }
KW_DATABASE = "DATABASE"i !ident_start { return 'DATABASE'; }
KW_SCHEME = "SCHEME"i !ident_start { return 'SCHEME'; }
KW_SCHEMA = "SCHEMA"i !ident_start { return 'SCHEMA'; }
KW_COLLATE = "COLLATE"i !ident_start { return 'COLLATE'; }

KW_ON = "ON"i !ident_start
Expand Down
11 changes: 6 additions & 5 deletions pegjs/flinksql.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -626,18 +626,19 @@ create_db_definition

create_db_stmt
= a:KW_CREATE __
k:(KW_DATABASE / KW_SCHEME) __
k:(KW_DATABASE / KW_SCHEMA) __
ife:if_not_exists_stmt? __
t:ident_without_kw_type __
t:proc_func_name __
c:create_db_definition? {
const keyword = k.toLowerCase()
return {
tableList: Array.from(tableList),
columnList: columnListTableAlias(columnList),
ast: {
type: a[0].toLowerCase(),
keyword: 'database',
keyword,
if_not_exists:ife,
database: t,
[keyword]: { db: t.schema, schema: t.name },
create_definitions: c,
}
}
Expand Down Expand Up @@ -3359,7 +3360,7 @@ KW_AS = "AS"i !ident_start
KW_TABLE = "TABLE"i !ident_start { return 'TABLE'; }
KW_TABLESPACE = "TABLESPACE"i !ident_start { return 'TABLESPACE'; }
KW_DATABASE = "DATABASE"i !ident_start { return 'DATABASE'; }
KW_SCHEME = "SCHEME"i !ident_start { return 'SCHEME'; }
KW_SCHEMA = "SCHEMA"i !ident_start { return 'SCHEMA'; }
KW_COLLATE = "COLLATE"i !ident_start { return 'COLLATE'; }

KW_ON = "ON"i !ident_start
Expand Down
11 changes: 6 additions & 5 deletions pegjs/hive.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -285,18 +285,19 @@ if_not_exists_stmt

create_db_stmt
= a:KW_CREATE __
k:(KW_DATABASE / KW_SCHEME) __
k:(KW_DATABASE / KW_SCHEMA) __
ife:if_not_exists_stmt? __
t:ident_without_kw_type __
t:proc_func_name __
c:create_db_definition? {
const keyword = k.toLowerCase()
return {
tableList: Array.from(tableList),
columnList: columnListTableAlias(columnList),
ast: {
type: a[0].toLowerCase(),
keyword: 'database',
keyword,
if_not_exists:ife,
database: t,
[keyword]: { db: t.schema, schema: t.name },
create_definitions: c,
}
}
Expand Down Expand Up @@ -2275,7 +2276,7 @@ KW_AS = "AS"i !ident_start
KW_TABLE = "TABLE"i !ident_start { return 'TABLE'; }
KW_TABLES = "TABLES"i !ident_start { return 'TABLES'; }
KW_DATABASE = "DATABASE"i !ident_start { return 'DATABASE'; }
KW_SCHEME = "SCHEME"i !ident_start { return 'SCHEME'; }
KW_SCHEMA = "SCHEMA"i !ident_start { return 'SCHEMA'; }
KW_COLLATE = "COLLATE"i !ident_start { return 'COLLATE'; }

KW_ON = "ON"i !ident_start
Expand Down
7 changes: 4 additions & 3 deletions pegjs/mariadb.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -344,16 +344,17 @@ create_db_stmt
= a:KW_CREATE __
k:(KW_DATABASE / KW_SCHEMA) __
ife:if_not_exists_stmt? __
t:ident_without_kw_type __
t:proc_func_name __
c:create_db_definition? {
const keyword = k.toLowerCase()
return {
tableList: Array.from(tableList),
columnList: columnListTableAlias(columnList),
ast: {
type: a[0].toLowerCase(),
keyword: 'database',
keyword,
if_not_exists:ife,
database: t,
[keyword]: { db: t.schema, schema: t.name },
create_definitions: c,
}
}
Expand Down
9 changes: 5 additions & 4 deletions pegjs/mysql.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -540,16 +540,17 @@ create_db_stmt
= a:KW_CREATE __
k:(KW_DATABASE / KW_SCHEMA) __
ife:if_not_exists_stmt? __
t:ident_without_kw_type __
t:proc_func_name __
c:create_db_definition? {
const keyword = k.toLowerCase()
return {
tableList: Array.from(tableList),
columnList: columnListTableAlias(columnList),
ast: {
type: a[0].toLowerCase(),
keyword: 'database',
if_not_exists: ife,
database: t,
keyword,
if_not_exists:ife,
[keyword]: { db: t.schema, schema: t.name },
create_definitions: c,
}
}
Expand Down
18 changes: 5 additions & 13 deletions pegjs/noql.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -359,30 +359,22 @@ create_db_stmt
= a:KW_CREATE __
k:(KW_DATABASE / KW_SCHEMA) __
ife:if_not_exists_stmt? __
t:ident_without_kw_type __
t:proc_func_name __
c:create_db_definition? {
/*
export type create_db_stmt = {
type: 'create',
keyword: 'database' | 'schema',
if_not_exists?: 'if not exists',
database: ident_without_kw_type,
create_definitions?: create_db_definition
}
=> AstStatement<create_db_stmt>
*/
const keyword = k.toLowerCase()
return {
tableList: Array.from(tableList),
columnList: columnListTableAlias(columnList),
ast: {
type: a[0].toLowerCase(),
keyword: 'database',
keyword,
if_not_exists:ife,
database: t,
[keyword]: { db: t.schema, schema: t.name },
create_definitions: c,
}
}
}

view_with
= KW_WITH __ c:("CASCADED"i / "LOCAL"i) __ "CHECK"i __ "OPTION" {
// => string
Expand Down
9 changes: 6 additions & 3 deletions pegjs/postgresql.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -386,19 +386,22 @@ create_db_stmt
type: 'create',
keyword: 'database' | 'schema',
if_not_exists?: 'if not exists',
database: ident_without_kw_type,
database?: { db: string, schema: string };
schema?: { db: string, schema: string };
create_definitions?: create_db_definition
}
=> AstStatement<create_db_stmt_t>
*/
const keyword = k.toLowerCase()
return {
tableList: Array.from(tableList),
columnList: columnListTableAlias(columnList),
ast: {
type: a[0].toLowerCase(),
keyword: 'database',
keyword,
if_not_exists:ife,
database: t,
replace: or && 'or replace',
[keyword]: { db: t.schema, schema: t.name },
create_definitions: c,
}
}
Expand Down
18 changes: 5 additions & 13 deletions pegjs/redshift.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -369,30 +369,22 @@ create_db_stmt
= a:KW_CREATE __
k:(KW_DATABASE / KW_SCHEMA) __
ife:if_not_exists_stmt? __
t:ident_without_kw_type __
t:proc_func_name __
c:create_db_definition? {
/*
export type create_db_stmt = {
type: 'create',
keyword: 'database' | 'schema',
if_not_exists?: 'if not exists',
database: ident_without_kw_type,
create_definitions?: create_db_definition
}
=> AstStatement<create_db_stmt>
*/
const keyword = k.toLowerCase()
return {
tableList: Array.from(tableList),
columnList: columnListTableAlias(columnList),
ast: {
type: a[0].toLowerCase(),
keyword: 'database',
keyword,
if_not_exists:ife,
database: t,
[keyword]: { db: t.schema, schema: t.name },
create_definitions: c,
}
}
}

view_with
= KW_WITH __ c:("CASCADED"i / "LOCAL"i) __ "CHECK"i __ "OPTION" {
// => string
Expand Down
Loading

0 comments on commit 444acd5

Please sign in to comment.