Which JDBC functions are called during a new database sync?

Hello,

I'm developing a new database driver and with the help from folks on this board I got to the point where I can now query our database using native queries in the SQL editor. However, the tables in the database are not getting properly discovered and all accesses from the GUI fail with:

error "No fields found for table "stations".",

Our database JDBC driver supports all the normal metadata functions to get information about the tables, e.g. conn.getMetaData(), md.getColumns.

I do see this query in our log being issued during the discovery process:

SELECT TRUE AS "_" FROM "weather"."weather" WHERE 1 <> 1 LIMIT 0

Is the metadata from that query used for the sync process?

I tried using log4j to trace the query-processor namespace, but I don't get any trace records. I also reviewed the source from other metabase database drivers and I see references to 'describe-table' however I haven't any success implementing that function.

Any guidance on how to proceed would be much appreciated.

Thanks!
Hank

Metabase log during the process of adding the new database

2021-04-01 08:17:33.271 Metabase[8600:56351682] INFO sync-metadata.tables :: Found new tables: (Table 'weather.cities' Table 'weather.stations' Table 'weather.weather' Table 'system.adtech_flat')
2021-04-01 08:17:33.300 Metabase[8600:56351682] INFO sync-metadata.tables :: Updating description for tables: (Table 'weather.cities' Table 'weather.stations' Table 'weather.weather' Table 'system.adtech_flat')
2021-04-01 08:17:33.300 Metabase[8600:56351682] INFO sync.util :: FINISHED: step 'sync-tables' for ocient Database 21 'Weather' (8.1 s)
2021-04-01 08:17:33.301 Metabase[8600:56351682] INFO sync.util :: STARTING: step 'sync-fields' for ocient Database 21 'Weather'
2021-04-01 08:17:37.375 Metabase[8600:56351667] (re)starting health checker @ 0x7ffb9b4b2e50...
2021-04-01 08:17:46.043 Metabase[8600:56351682] INFO sync.util :: FINISHED: step 'sync-fields' for ocient Database 21 'Weather' (12.7 s)
2021-04-01 08:17:46.044 Metabase[8600:56351682] INFO sync.util :: STARTING: step 'sync-fks' for ocient Database 21 'Weather'
2021-04-01 08:17:46.049 Metabase[8600:56351682] INFO sync.util :: FINISHED: step 'sync-fks' for ocient Database 21 'Weather' (4.5 ms)
2021-04-01 08:17:46.049 Metabase[8600:56351682] INFO sync.util :: STARTING: step 'sync-metabase-metadata' for ocient Database 21 'Weather'
2021-04-01 08:17:52.699 Metabase[8600:56351682] INFO sync.util :: FINISHED: step 'sync-metabase-metadata' for ocient Database 21 'Weather' (6.6 s)
2021-04-01 08:17:52.752 Metabase[8600:56351682] INFO sync.util :: FINISHED: Sync metadata for ocient Database 21 'Weather' (27.6 s)
2021-04-01 08:17:52.754 Metabase[8600:56351682] INFO sync.util :: STARTING: Analyze data for ocient Database 21 'Weather'
2021-04-01 08:17:52.757 Metabase[8600:56351682] INFO sync.util :: STARTING: step 'fingerprint-fields' for ocient Database 21 'Weather'
2021-04-01 08:17:52.765 Metabase[8600:56351682] INFO sync.analyze :: fingerprint-fields Analyzed [···········································] :disappointed: 15% Table 95 'weather.stations'
2021-04-01 08:17:52.770 Metabase[8600:56351682] INFO sync.analyze :: fingerprint-fields Analyzed [
···································] :confused: 31% Table 97 'system.adtech_flat'
2021-04-01 08:17:52.774 Metabase[8600:56351682] INFO sync.util :: FINISHED: step 'fingerprint-fields' for ocient Database 21 'Weather' (16.6 ms)
2021-04-01 08:17:52.774 Metabase[8600:56351682] INFO sync.util :: STARTING: step 'classify-fields' for ocient Database 21 'Weather'
2021-04-01 08:17:52.779 Metabase[8600:56351682] INFO sync.analyze :: classify-fields Analyzed [
···························] :grimacing: 46% Table 95 'weather.stations'
2021-04-01 08:17:52.782 Metabase[8600:56351682] INFO sync.analyze :: classify-fields Analyzed [
····················] :relieved: 62% Table 97 'system.adtech_flat'
2021-04-01 08:17:52.782 Metabase[8600:56351682] INFO sync.util :: FINISHED: step 'classify-fields' for ocient Database 21 'Weather' (7.6 ms)
INFO sync.util :: STARTING: step 'classify-tables' for ocient Database 21 'Weather'
2021-04-01 08:17:52.796 Metabase[8600:56351682] INFO sync.analyze :: classify-tables Analyzed [
***********************············] :yum: 77% Table 95 'weather.stations'
2021-04-01 08:17:52.801 Metabase[8600:56351682] INFO sync.analyze :: classify-tables Analyzed [**********************************************····] :heart_eyes: 92% Table 97 'system.adtech_flat'
2021-04-01 08:17:52.802 Metabase[8600:56351682] INFO sync.util :: FINISHED: step 'classify-tables' for ocient Database 21 'Weather' (18.8 ms)
2021-04-01 08:17:52.811 Metabase[8600:56351682] INFO sync.util :: FINISHED: Analyze data for ocient Database 21 'Weather' (56.7 ms)
2021-04-01 08:17:52.812 Metabase[8600:56351682] INFO sync.util :: STARTING: Cache field values in ocient Database 21 'Weather'
2021-04-01 08:17:52.812 Metabase[8600:56351682] INFO sync.util :: STARTING: step 'update-field-values' for ocient Database 21 'Weather'
2021-04-01 08:17:52.818 Metabase[8600:56351682] INFO sync.util :: FINISHED: step 'update-field-values' for ocient Database 21 'Weather' (5.5 ms)
2021-04-01 08:17:52.820 Metabase[8600:56351682] INFO sync.util :: FINISHED: Cache field values in ocient Database 21 'Weather' (8.2 ms)
2021-04-01 08:17:52.820 Metabase[8600:56351682] INFO sync.util :: FINISHED: Sync ocient Database 21 'Weather' (27.6 s)

Hi @hcalzaretta
Which database are you building a driver for?
Yes, that query is used during sync to figure out if there are privileges to the tables.
Have you tried looking at how other drivers are doing overrides? Example Presto or Mongo, just for the core drivers, or one of the many third-party drivers.
Modify defn simple-select-probe-query

Hi @flamber,

We are a relatively new DB company called Ocient. I have looked at some of the other metabase drivers out there and have tried some of the methods used there without any success. Thanks for the link, I will see if that helps.

-Hank