Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table Sync Fails in Metabase v51.4 with Dremio Driver 1.5.0 #19

Open
ixipixi opened this issue Nov 20, 2024 · 5 comments
Open

Table Sync Fails in Metabase v51.4 with Dremio Driver 1.5.0 #19

ixipixi opened this issue Nov 20, 2024 · 5 comments

Comments

@ixipixi
Copy link

ixipixi commented Nov 20, 2024

This was working on 51 at one time.

Error Message

2024-11-20 17:18:15 2024-11-20 23:18:15,739 ERROR sync.fetch-metadata :: Error while fetching metdata with 'fields-metadata' 2024-11-20 17:18:15 java.sql.SQLException: Failed to create prepared statement: error_id: "d144dc1d-6f2d-4ed9-a8de-e4e36081888b" 2024-11-20 17:18:15 error_type: VALIDATION

Metabase Diagnostics

{
"browser-info": {
"language": "en-US",
"platform": "Win32",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36",
"vendor": "Google Inc."
},
"metabase-info": {
"databases": [
"h2",
"postgres",
"dremio"
],
"run-mode": "prod",
"plan-alias": "enterprise-self-hosted",
"version": {
"date": "2024-11-11",
"tag": "v1.51.3",
"hash": "d757d0b"
},
"settings": {
"report-timezone": null
},
"hosting-env": "unknown",
"application-database": "postgres",
"application-database-details": {
"database": {
"name": "PostgreSQL",
"version": "15.1 (Debian 15.1-1.pgdg110+1)"
},
"jdbc-driver": {
"name": "PostgreSQL JDBC Driver",
"version": "42.7.3"
}
}
},
"system-info": {
"file.encoding": "UTF-8",
"java.runtime.name": "OpenJDK Runtime Environment",
"java.runtime.version": "11.0.25+9",
"java.vendor": "Eclipse Adoptium",
"java.vendor.url": "https://adoptium.net/",
"java.version": "11.0.25",
"java.vm.name": "OpenJDK 64-Bit Server VM",
"java.vm.version": "11.0.25+9",
"os.name": "Linux",
"os.version": "5.15.167.4-microsoft-standard-WSL2",
"user.language": "en",
"user.timezone": "GMT"
}
}

@paoliniluis
Copy link

@Baoqi @RonildoSouza

@luizarakaki
Copy link

Some guidance on how we believe you can resolve the issue

@rciszynski
Copy link

rciszynski commented Dec 6, 2024

Hello

I have this error too. I didn't notice the problem until I needed to update the column list from Dremio.
I tried recompiling the driver with the suggested fix:

`(driver/register! :dremio, :parent #{:postgres ::legacy/use-legacy-classes-for-read-and-set})

(doseq [[feature supported?] {:table-privileges false
:set-timezone false
:describe-fields false
:describe-fks false
:describe-indexes false
:connection-impersonation false}]
(defmethod driver/database-supports? [:dremio feature] [_driver _feature _db] supported?))
`

It didn't change anything. The problem probably results from using part of the postgres driver code, when forcing database schema synchronization from Metabase, Dremio displays queries like:

`
SELECT nspname, typname FROM pg_type t JOIN pg_namespace n ON n.oid = t.typnamespace WHERE t.oid IN (SELECT DISTINCT enumtypid FROM pg_enum e)

SELECT "fk_ns"."nspname" AS "fk-table-schema", "fk_table"."relname" AS "fk-table-name", "fk_column"."attname" AS "fk-column-name", "pk_ns"."nspname" AS "pk-table-schema", "pk_table"."relname" AS "pk-table-name", "pk_column"."attname" AS "pk-column-name" FROM "pg_constraint" AS "c" INNER JOIN "pg_class" AS "fk_table" ON "c"."conrelid" = "fk_table"."oid" INNER JOIN "pg_namespace" AS "fk_ns" ON "c"."connamespace" = "fk_ns"."oid" INNER JOIN "pg_attribute" AS "fk_column" ON "c"."conrelid" = "fk_column"."attrelid" INNER JOIN "pg_class" AS "pk_table" ON "c"."confrelid" = "pk_table"."oid" INNER JOIN "pg_namespace" AS "pk_ns" ON "pk_table"."relnamespace" = "pk_ns"."oid" INNER JOIN "pg_attribute" AS "pk_column" ON "c"."confrelid" = "pk_column"."attrelid" WHERE fk_ns.nspname !~ '^information_schema|catalog_history|pg_' AND ("c"."contype" = 'f'::char) AND ("fk_column"."attnum" = ANY(c.conkey)) AND ("pk_column"."attnum" = ANY(c.confkey)) AND ("fk_ns"."nspname" IN (?)) ORDER BY "fk-table-schema" ASC, "fk-table-name" ASC
`
Dremio is not compatible with Postgresql, so looking at the query, it's no wonder it doesn't work - there are no such objects in Dremio.

I don't have the knowledge to fix it, so I'm also waiting for help in this topic or any workaround.

Best regards

@rciszynski
Copy link

rciszynski commented Dec 12, 2024

Hi

I don't know why or when, but the driver I recompiled started working. The only change in the dremio.clj code is:

@@ -29,6 +29,9 @@
  (doseq [[feature supported?] {:table-privileges                false
                               :set-timezone                    false
+                              :describe-fields                 false
+                              :describe-fks                    false
+                              :describe-indexes                false
                               :connection-impersonation        false}]
   (defmethod driver/database-supports? [:dremio feature] [_driver _feature _db] supported?))

Tested on version 0.51.5 and 0.52.2
Strange, but it works for me :)

Best regards

@ilyadim
Copy link

ilyadim commented Dec 24, 2024

Thanks this worked for me as well here's the steps I took as someone that's new to this to recompile:
Clone correct metabase version repo to a folder
Clone dremio driver repo to the same folder

Edited dremio.clj file by adding new parameters

Terminal into dremio driver folder and run build.sh from driver folder (this required multiple dependency installs like java which was a pain to install and Clojure)

.jar file is output in ‘target’ folder in dremio driver folder

kubectl cp .jar file from local to plugin folder in metabase pod, delete/restart pod

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants