-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cubesql): Support new Metabase meta queries
- Loading branch information
1 parent
00c2a6b
commit 0bc09fd
Showing
5 changed files
with
185 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
rust/cubesql/cubesql/src/compile/snapshots/cubesql__compile__tests__has_table_privilege.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
source: cubesql/src/compile/mod.rs | ||
expression: "execute_query(\"SELECT\n relname,\n has_table_privilege('ovr', relname, 'SELECT') \\\"select\\\",\n has_table_privilege('ovr', relname, 'INSERT') \\\"insert\\\"\n FROM pg_class\n ORDER BY relname ASC\n \".to_string(),\n DatabaseProtocol::PostgreSQL).await?" | ||
--- | ||
+---------------------------+--------+--------+ | ||
| relname | select | insert | | ||
+---------------------------+--------+--------+ | ||
| KibanaSampleDataEcommerce | true | false | | ||
| Logs | true | false | | ||
| NumberCube | true | false | | ||
| WideCube | true | false | | ||
+---------------------------+--------+--------+ |
12 changes: 12 additions & 0 deletions
12
...esql/src/compile/snapshots/cubesql__compile__tests__has_table_privilege_default_user.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
source: cubesql/src/compile/mod.rs | ||
expression: "execute_query(\"SELECT\n relname,\n has_table_privilege(relname, 'SELECT') \\\"select\\\",\n has_table_privilege(relname, 'INSERT') \\\"insert\\\"\n FROM pg_class\n ORDER BY relname ASC\n \".to_string(),\n DatabaseProtocol::PostgreSQL).await?" | ||
--- | ||
+---------------------------+--------+--------+ | ||
| relname | select | insert | | ||
+---------------------------+--------+--------+ | ||
| KibanaSampleDataEcommerce | true | false | | ||
| Logs | true | false | | ||
| NumberCube | true | false | | ||
| WideCube | true | false | | ||
+---------------------------+--------+--------+ |
12 changes: 12 additions & 0 deletions
12
...ubesql/src/compile/snapshots/cubesql__compile__tests__metabase_table_privilege_query.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
source: cubesql/src/compile/mod.rs | ||
expression: "execute_query(r#\"\n with table_privileges as (\n\t select\n\t NULL as role,\n\t t.schemaname as schema,\n\t t.objectname as table,\n\t pg_catalog.has_table_privilege(current_user, '\"' || t.schemaname || '\"' || '.' || '\"' || t.objectname || '\"', 'UPDATE') as update,\n\t pg_catalog.has_table_privilege(current_user, '\"' || t.schemaname || '\"' || '.' || '\"' || t.objectname || '\"', 'SELECT') as select,\n\t pg_catalog.has_table_privilege(current_user, '\"' || t.schemaname || '\"' || '.' || '\"' || t.objectname || '\"', 'INSERT') as insert,\n\t pg_catalog.has_table_privilege(current_user, '\"' || t.schemaname || '\"' || '.' || '\"' || t.objectname || '\"', 'DELETE') as delete\n\t from (\n\t select schemaname, tablename as objectname from pg_catalog.pg_tables\n\t union\n\t select schemaname, viewname as objectname from pg_catalog.pg_views\n\t union\n\t select schemaname, matviewname as objectname from pg_catalog.pg_matviews\n\t ) t\n\t where t.schemaname !~ '^pg_'\n\t and t.schemaname <> 'information_schema'\n\t and pg_catalog.has_schema_privilege(current_user, t.schemaname, 'USAGE')\n\t)\n\tselect t.*\n\tfrom table_privileges t\n order by t.schema, t.table\n \"#.to_string(),\n DatabaseProtocol::PostgreSQL).await?" | ||
--- | ||
+------+--------+---------------------------+--------+--------+--------+--------+ | ||
| role | schema | table | update | select | insert | delete | | ||
+------+--------+---------------------------+--------+--------+--------+--------+ | ||
| NULL | public | KibanaSampleDataEcommerce | false | true | false | false | | ||
| NULL | public | Logs | false | true | false | false | | ||
| NULL | public | NumberCube | false | true | false | false | | ||
| NULL | public | WideCube | false | true | false | false | | ||
+------+--------+---------------------------+--------+--------+--------+--------+ |