Commit Graph

33 Commits

Author SHA1 Message Date
John Bodley c38529741e
chore(sql_parse): Provide more meaningful SQLGlot errors (#27858) 2024-04-03 07:10:52 -07:00
John Bodley 5ab95aaf7d
chore(sql_parse): Strip leading/trailing whitespace in Jinja macro extraction (#27842) 2024-04-02 17:08:42 -07:00
John Bodley 28cbedb82f
fix: Leverage actual database for rendering Jinjarized SQL (#27646) 2024-03-27 08:12:25 +13:00
Beto Dealmeida cd7972d05b
feat: support for KQL in `SQLScript` (#27522) 2024-03-22 12:48:20 -04:00
John Bodley b25dd0c055
fix(sql_parse): Ensure table extraction handles Jinja templating (#27470) 2024-03-22 13:39:28 +13:00
Beto Dealmeida 36fd3c0bf8
feat: `improve _extract_tables_from_sql` (#26748) 2024-03-18 13:02:58 -04:00
Beto Dealmeida 26d8077e97
chore: improve SQL parsing (#26767) 2024-03-13 18:27:01 -04:00
John Bodley 2c564817f1
fix(sqlglot): Address regressions introduced in #26476 (#27217) 2024-02-24 08:47:36 +13:00
John Bodley 847ed3f5b0
refactor: Ensure Flask framework leverages the Flask-SQLAlchemy session (Phase II) (#26909) 2024-02-14 06:20:15 +13:00
Beto Dealmeida c0b57bd1c3
feat(sqlparse): improve table parsing (#26476) 2024-01-22 11:16:50 -05:00
Beto Dealmeida 2bd611916d
feat: safer insert RLS (#20323) 2023-11-08 22:52:25 -05:00
Beto Dealmeida bb002d6147
fix: is_select with UNION (#25290) 2023-09-14 09:05:19 -07:00
Beto Dealmeida 2f68010729
fix: `is_select` (#25189) 2023-09-06 11:54:25 -07:00
Daniel Vaz Gaspar 357986103b
fix: CTE queries with non-SELECT statements (#25014) 2023-08-19 15:49:15 +01:00
John Bodley a4d5d7c6b9
chore(pre-commit): Add pyupgrade and pycln hooks (#24197) 2023-06-01 12:01:10 -07:00
Beto Dealmeida 2a1a061a3e
fix: handle comments in `has_table_query` (#23882) 2023-05-01 11:06:54 -07:00
Francisco Muniz de Paula Neto e9b4022787
fix: is_select check for lowercase select with "WITH" clauses (#22370) 2023-04-18 08:59:50 -07:00
Josh Soref 02e5dcbbf2
chore(misc): Spelling (#19678)
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2023-01-25 16:35:08 -07:00
Erik Cederstrand 82bd5a31b8
chore(deps): Unpin sqlparse dependency (#21581)
Co-authored-by: Erik Cederstrand <erik@adamatics.com>
Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>
2022-09-26 17:41:04 +03:00
Jesse Yang 7e836e9b04
test: autouse app_context in unit tests (#20911) 2022-08-02 15:42:50 -07:00
John Bodley ad308fbde2
chore(rls): Remove passing global username (#20344)
* chore(rls): Remove passing global username

* Update manager.py

* Update manager.py

* Update manager.py

* Update manager.py

Co-authored-by: John Bodley <john.bodley@airbnb.com>
2022-07-05 10:51:24 -07:00
Beto Dealmeida f2881e5bbd
feat: RLS for SQL Lab (#19999)
* feat: RLS for SQL Lab

* Small fixes

* Pass username to security manager

* Update docstrings

* Add tests

* Remove type from docstring
2022-05-12 11:03:01 -07:00
Jesse Yang 231716cb50
perf: refactor SIP-68 db migrations with INSERT SELECT FROM (#19421) 2022-04-19 18:58:18 -07:00
Beto Dealmeida 6828624f61
feat: improve adhoc SQL validation (#19454)
* feat: improve adhoc SQL validation

* Small changes

* Add more unit tests
2022-03-31 11:55:19 -07:00
Ville Brofeldt f341025d80
feat: add support for comments in adhoc clauses (#19248)
* feat: add support for comments in adhoc clauses

* sanitize remaining freeform clauses

* sanitize adhoc having in frontend

* address review comment
2022-03-18 15:08:06 -07:00
Lily Kuang 50902d51f5
fix: allow subquery in ad-hoc SQL (WIP) (#19242)
* allow adhoc subquery

* add config for allow ad hoc subquery

* default to true allow adhoc subquery

* fix test

* Update superset/errors.py

Co-authored-by: Beto Dealmeida <roberto@dealmeida.net>

* Update superset/connectors/sqla/utils.py

Co-authored-by: David Aaron Suddjian <1858430+suddjian@users.noreply.github.com>

* rename and add doc string

* fix for big query test

* Update superset/connectors/sqla/utils.py

Co-authored-by: Beto Dealmeida <roberto@dealmeida.net>

* Apply suggestions from code review

Co-authored-by: Beto Dealmeida <roberto@dealmeida.net>

* add test

* update validate adhoc subquery

Co-authored-by: Beto Dealmeida <roberto@dealmeida.net>
Co-authored-by: David Aaron Suddjian <1858430+suddjian@users.noreply.github.com>
2022-03-18 10:04:55 -07:00
Beto Dealmeida 8234395466
feat: helper functions for RLS (#19055)
* feat: helper functions for RLS

* Add function to inject RLS

* Add UNION tests

* Add tests for schema

* Add more tests; cleanup

* has_table_query via tree traversal

* Wrap existing predicate in parenthesis

* Clean up logic

* Improve table matching
2022-03-11 14:47:11 -08:00
Erik Ritter 14b9298ef7
fix: revert #17654 to fix subselect table name parsing (#18017) 2022-01-12 21:28:23 -08:00
John Bodley 63ca09e345
fix: Workaround for sqlparse issue #652 (#17995)
* fix: Workaround for sqlparse issue #652

* Update superset/sql_parse.py

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>

* Update sql_parse.py

Co-authored-by: John Bodley <john.bodley@airbnb.com>
Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>
2022-01-12 14:03:56 +13:00
Ville Brofeldt 3a42071e0f
chore(sql): clean up invalid filter clause exception types (#17702)
* chore(sql): clean up invalid filter clause exception types

* fix lint

* rename exception
2021-12-09 17:49:32 +02:00
Beto Dealmeida 8c25f2f356
fix: extract tables doesn't work with reserved keywords (#17654) 2021-12-08 05:50:42 -08:00
Beto Dealmeida 93bafa0e6a
feat: improve logic in is_select (#17329)
* feat: improve logic in is_select

* Add more edge cases
2021-11-02 17:30:12 -07:00
Beto Dealmeida 48a61bacc5
fix: handle CTEs with comments on is_select (#16769) 2021-09-21 16:23:54 -07:00