Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
22ce27f1
Unverified
Commit
22ce27f1
authored
1 year ago
by
Cal Herries
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Remove special describe-table-fks for redshift (#39011)
parent
585891d0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/drivers/redshift/src/metabase/driver/redshift.clj
+0
-32
0 additions, 32 deletions
modules/drivers/redshift/src/metabase/driver/redshift.clj
with
0 additions
and
32 deletions
modules/drivers/redshift/src/metabase/driver/redshift.clj
+
0
−
32
View file @
22ce27f1
...
...
@@ -49,38 +49,6 @@
[
&
args
]
(
apply
(
get-method
driver/describe-table
:sql-jdbc
)
args
))
;; The Postgres JDBC .getImportedKeys method doesn't work for Redshift, and we're not allowed to access
;; information_schema.constraint_column_usage, so we'll have to use this custom query instead
;;
;; See also: [Related Postgres JDBC driver issue on GitHub](https://github.com/pgjdbc/pgjdbc/issues/79)
;; [How to access the equivalent of information_schema.constraint_column_usage in Redshift](https://forums.aws.amazon.com/thread.jspa?threadID=133514)
(
def
^
:private
fk-query
"SELECT source_column.attname AS \"fk-column-name\",
dest_table.relname AS \"dest-table-name\",
dest_table_ns.nspname AS \"dest-table-schema\",
dest_column.attname AS \"dest-column-name\"
FROM pg_constraint c
JOIN pg_namespace n ON c.connamespace = n.oid
JOIN pg_class source_table ON c.conrelid = source_table.oid
JOIN pg_attribute source_column ON c.conrelid = source_column.attrelid
JOIN pg_class dest_table ON c.confrelid = dest_table.oid
JOIN pg_namespace dest_table_ns ON dest_table.relnamespace = dest_table_ns.oid
JOIN pg_attribute dest_column ON c.confrelid = dest_column.attrelid
WHERE c.contype = 'f'::char
AND source_table.relname = ?
AND n.nspname = ?
AND source_column.attnum = ANY(c.conkey)
AND dest_column.attnum = ANY(c.confkey)"
)
(
defmethod
driver/describe-table-fks
:redshift
[
_
database
table
]
(
set
(
for
[
fk
(
jdbc/query
(
sql-jdbc.conn/db->pooled-connection-spec
database
)
[
fk-query
(
:name
table
)
(
:schema
table
)])]
{
:fk-column-name
(
:fk-column-name
fk
)
:dest-table
{
:name
(
:dest-table-name
fk
)
:schema
(
:dest-table-schema
fk
)}
:dest-column-name
(
:dest-column-name
fk
)})))
(
defmethod
driver/db-start-of-week
:redshift
[
_
]
:sunday
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment