Commit graph

119 commits

Author SHA1 Message Date
pawel.leszczynski
548191814c
support snowflake alter table swap with (#825)
Signed-off-by: Pawel Leszczynski <leszczynski.pawel@gmail.com>
2023-03-07 07:16:39 -05:00
Andrew Lamb
7f4c9132d7
Fix table alias parsing regression in 0.31.0 by backing out redshift column definition list (#827)
* Fix table alias parsing regression

* Revert "Support redshift's columns definition list for system information functions (#769)"

This reverts commit c35dcc93a7.
2023-03-06 11:43:22 -05:00
Maciej Skrzypkowski
c35dcc93a7
Support redshift's columns definition list for system information functions (#769)
* parsing of redshift's column definition list for
pg_get_late_binding_view_cols
pg_get_cols
pg_get_grantee_by_iam_role
pg_get_iam_role_by_user

* Renamed ColsDefinition to TableAliasDefinition

added generic dialect

* Tests fixed

* Visitor for IdentPair

* Parsing redshift table alias based on indentifier and
parentheses instead of function name

* fix clippy

---------

Co-authored-by: Maciej Skrzypkowski <maciej.skrzypkowski@satoricyber.com>
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2023-02-17 14:04:59 -05:00
Maciej Obuchowski
a2fea10f89
snowflake: add support for TRANSIENT keyword (#807)
* snowflake: add support for TRANSIENT keyword

Signed-off-by: Maciej Obuchowski <obuchowski.maciej@gmail.com>

* fix clippy

---------

Signed-off-by: Maciej Obuchowski <obuchowski.maciej@gmail.com>
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2023-02-17 13:55:56 -05:00
Jeffrey
17f604f757
Support RENAME for wildcard SELECTs (#784) 2023-01-02 10:29:06 -05:00
yuval-illumex
01fd20f0a3
Support the type key (#750) 2022-12-06 16:07:53 -05:00
Augusto Fotino
b3688513eb
feat: add support for except clause on wildcards (#745) 2022-12-05 14:03:59 -05:00
Augusto Fotino
fa6bd01b19
Support EXCLUDE support for snowflake and generic dialect (#721)
The exclude clause can be used after a possibly qualified on SELECT
2022-11-30 12:29:43 -05:00
SuperBo
87b4a168cb
Parse ARRAY_AGG for Bigquery and Snowflake (#662) 2022-11-11 15:25:07 -05:00
omer-shtivi
0428ac742b
Add MySql, BigQuery to all dialects (#697)
* Add MySql, BigQuery to all dialects

* move unsupported on mysql from common
2022-11-07 15:32:47 -05:00
yuval-illumex
0f7e144890
Support the ARRAY type of Snowflake (#699)
* Snowflake Array

* Use the array data type

* Try to fix build

* Try to fix build

* Change Array to option

* Remove unused import
2022-11-04 10:25:25 -04:00
yuval-illumex
93a050e5f0
Snowflake: Support semi-structured data (#693)
* Support parse json in snowflake

* MR Review

* Lint

* Try to fix right as value

* Fix tests

* Fix lint

* Add generic dialect

* Add support in key location
2022-11-02 12:05:35 -04:00
Wei-Ting Kuo
076b587bb2
Support NestedJoin with an alias (#551)
* add alias for nestedjoin

* fmt

* add/modify test cases

* inline nestedjoin instead of macro
2022-08-03 19:41:15 -04:00
Qinxuan Chen
67e17b27f5
Make clippy happy (#330)
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
2021-08-19 23:02:15 +02:00
Nickolay Ponomarev
ad72cda6b0 [snowflake] Support specifying an alias after FROM (table_factor)
Snowflake diverges from the standard and from most of the other
implementations by allowing extra parentheses not only around a join,
but around lone table names (e.g. `FROM (mytable [AS alias])`) and
around derived tables (e.g. `FROM ((SELECT ...)  [AS alias])`) as well.

Initially this was implemented in https://github.com/ballista-compute/sqlparser-rs/issues/154
by (ab)using `TableFactor::NestedJoin` to represent anything nested in
extra set of parens.

Afterwards we learned in https://github.com/ballista-compute/sqlparser-rs/issues/223
that in cases of such extraneous nesting Snowflake allows specifying the
alias both inside and outside parens, but not both - consider:

    FROM (table_factor AS inner_alias) AS outer_alias

We've considered implementing this by changing `TableFactor::NestedJoin`
to a `TableFactor::Nested { inner: TableWithJoins, alias:
Option<TableAlias> }`, but that seemed too generic, as no known dialect
supports duplicate aliases, as shown above, nor naming nested joins
`(foo NATURAL JOIN bar) alias`. So we decided on making a smaller change
(with no modifications to the AST), that is also more appropriate to the
contributors to the Snowflake dialect:


1) Revert #154 by rejecting `FROM (table or derived table)` in most dialects.

2) For `dialect_of!(self is SnowflakeDialect | GenericDialect)` parse
and strip the extraneous parentheses, e.g.

   `(mytable) AS alias` -> `(mytable AS alias)`


Co-authored-by: Eyal Leshem <eyal@satoricyber.com>
2020-10-13 09:51:02 +03:00
Nickolay Ponomarev
4128dfe1db Introduce tests/test_utils/mod.rs and use it consistently
To share helper macros between various tests/* we added a new module
(tests/macros/mod.rs). This made the prologue to be used in tests quite
long and a little weird:
```
#[macro_use]
#[path = "macros/mod.rs"]
mod macros;
use sqlparser::test_utils::*;
```

This simplifies it to:
```
#[macro_use]
mod test_utils;
use test_utils::*;
```
- and switches all existing tests to the new prologue simultaneously...

...while fixing a few other inconsistencies and adding a few comments
about the way `test_utils` work.
2020-10-12 06:52:00 +03:00
Nickolay Ponomarev
99fb633221 Move existing SF tests to sqlparser_snowflake.rs
Co-authored-by: Eyal Leshem <eyal@satoricyber.com>
2020-10-05 08:42:26 +03:00
eyalleshem
1c6077c0db
[snowflake] Support single line comments starting with '#' or '//' (#264)
Co-authored-by: Eyal Leshem <eyal@satoricyber.com>
2020-09-07 03:57:37 +03:00
eyalleshem
f500a42e99
Add snowflake dialect (#259) 2020-08-12 04:55:22 +03:00