Database sync issue with new version (0.36.0)

After upgrading to the version 0.36.0, we are getting database sync error. We are using Athena db and connected via Athena driver. Due to db sync error, schema of newly created tables is not appearing in metabase.

Below are the logs:

07-29 10:45:41 ERROR sync.util :: Error syncing Fields for Table 'Table 5 'testdb.sample_table''
clojure.lang.ExceptionInfo: Output of table-metadata does not match schema:

	   {:fields #{{:database-position missing-required-key}}}

 {:type :schema.core/error, :schema {:name (constrained Str "Non-blank string"), :schema (maybe (constrained Str "Non-blank string")), :fields #{{:base-type (pred "Valid field type"), #schema.core.OptionalKey{:k :pk?} java.lang.Boolean, :name (constrained Str "Non-blank string"), #schema.core.OptionalKey{:k :field-comment} (maybe (constrained Str "Non-blank string")), #schema.core.OptionalKey{:k :custom} {Any Any}, :database-type (maybe (constrained Str "Non-blank string")), #schema.core.OptionalKey{:k :nested-fields} #{(recursive (var metabase.sync.interface/TableMetadataField))}, #schema.core.OptionalKey{:k :special-type} (maybe (pred "Valid field type")), :database-position (constrained Int "Integer greater than or equal to zero")}}, #schema.core.OptionalKey{:k :description} (maybe (constrained Str "Non-blank string"))}, :value {:name "issue_refund", :schema "flockdb", :fields #{{:name "eventname", :database-type "string", :base-type :type/Text} {:name "eventts", :database-type "string", :base-type :type/Text} {:name "refund_credits", :database-type "string", :base-type :type/Text} {:name "dt", :database-type "date", :base-type :type/Date} {:name "teamid", :database-type "string", :base-type :type/Text} {:name "team_id", :database-type "string", :base-type :type/Text} {:name "currency", :database-type "string", :base-type :type/Text} {:name "refund_amount", :database-type "string", :base-type :type/Text} {:name "reason", :database-type "string", :base-type :type/Text} {:name "timestamp", :database-type "string", :base-type :type/Text}}}, :error {:fields #{{:database-position missing-required-key}}}}
	at metabase.sync.fetch_metadata$fn__52946$table_metadata__52951.invoke(fetch_metadata.clj:15)
	at metabase.sync.sync_metadata.fields.fetch_metadata$fn__53268$db_metadata__53273$fn__53274.invoke(fetch_metadata.clj:86)
	at metabase.sync.sync_metadata.fields.fetch_metadata$fn__53268$db_metadata__53273.invoke(fetch_metadata.clj:82)
	at metabase.sync.sync_metadata.fields$fn__53750$sync_fields_for_table_BANG___53759$fn__53762$fn__53763.invoke(fields.clj:75)
	at metabase.sync.util$do_with_error_handling.invokeStatic(util.clj:149)
	at metabase.sync.util$do_with_error_handling.invoke(util.clj:142)
	at metabase.sync.sync_metadata.fields$fn__53750$sync_fields_for_table_BANG___53759$fn__53762.invoke(fields.clj:74)
	at metabase.sync.sync_metadata.fields$fn__53750$sync_fields_for_table_BANG___53759.invoke(fields.clj:68)
	at clojure.core$partial$fn__5839.invoke(core.clj:2624)
	at clojure.core$map$fn__5866.invoke(core.clj:2753)
	at clojure.lang.LazySeq.sval(LazySeq.java:42)
	at clojure.lang.LazySeq.seq(LazySeq.java:51)
	at clojure.lang.RT.seq(RT.java:535)
	at clojure.core$seq__5402.invokeStatic(core.clj:137)
	at clojure.core$filter$fn__5893.invoke(core.clj:2809)
	at clojure.lang.LazySeq.sval(LazySeq.java:42)
	at clojure.lang.LazySeq.seq(LazySeq.java:51)
	at clojure.lang.Cons.next(Cons.java:39)
	at clojure.lang.RT.boundedLength(RT.java:1792)
	at clojure.lang.RestFn.applyTo(RestFn.java:130)
	at clojure.core$apply.invokeStatic(core.clj:667)
	at clojure.core$apply.invoke(core.clj:660)
	at metabase.sync.sync_metadata.fields$fn__53788$sync_fields_BANG___53793$fn__53794.invoke(fields.clj:88)
	at metabase.sync.sync_metadata.fields$fn__53788$sync_fields_BANG___53793.invoke(fields.clj:80)
	at metabase.sync.util$fn__42205$run_step_with_metadata__42210$fn__42214$fn__42216.invoke(util.clj:345)
	at metabase.sync.util$with_start_and_finish_logging_STAR_.invokeStatic(util.clj:102)
	at metabase.sync.util$with_start_and_finish_logging_STAR_.invoke(util.clj:96)
	at metabase.sync.util$with_start_and_finish_debug_logging.invokeStatic(util.clj:119)
	at metabase.sync.util$with_start_and_finish_debug_logging.invoke(util.clj:116)
	at metabase.sync.util$fn__42205$run_step_with_metadata__42210$fn__42214.invoke(util.clj:342)
	at metabase.sync.util$fn__42205$run_step_with_metadata__42210.invoke(util.clj:337)
	at metabase.sync.util$fn__42397$run_sync_operation__42402$fn__42403$fn__42404.invoke(util.clj:430)
	at clojure.core$mapv$fn__8445.invoke(core.clj:6912)
	at clojure.lang.PersistentVector.reduce(PersistentVector.java:343)
	at clojure.core$reduce.invokeStatic(core.clj:6827)
	at clojure.core$mapv.invokeStatic(core.clj:6903)
	at clojure.core$mapv.invoke(core.clj:6903)
	at metabase.sync.util$fn__42397$run_sync_operation__42402$fn__42403.invoke(util.clj:430)
	at metabase.sync.util$fn__42397$run_sync_operation__42402.invoke(util.clj:424)
	at metabase.sync.sync_metadata$fn__54462$sync_db_metadata_BANG___54467$fn__54468$fn__54469.invoke(sync_metadata.clj:51)
	at metabase.sync.util$do_with_error_handling.invokeStatic(util.clj:149)
	at metabase.sync.util$do_with_error_handling.invoke(util.clj:142)
	at metabase.sync.util$do_with_error_handling.invokeStatic(util.clj:145)
	at metabase.sync.util$do_with_error_handling.invoke(util.clj:142)
	at clojure.core$partial$fn__5839.invoke(core.clj:2623)
	at metabase.driver$fn__22447.invokeStatic(driver.clj:540)
	at metabase.driver$fn__22447.invoke(driver.clj:540)
	at clojure.lang.MultiFn.invoke(MultiFn.java:239)
	at metabase.sync.util$sync_in_context$fn__42117.invoke(util.clj:138)
	at metabase.sync.util$with_db_logging_disabled$fn__42114.invoke(util.clj:129)
	at metabase.sync.util$with_start_and_finish_logging_STAR_.invokeStatic(util.clj:102)
	at metabase.sync.util$with_start_and_finish_logging_STAR_.invoke(util.clj:96)
	at metabase.sync.util$with_start_and_finish_logging$fn__42103.invoke(util.clj:114)
	at metabase.sync.util$with_sync_events$fn__42098.invoke(util.clj:88)
	at metabase.sync.util$with_duplicate_ops_prevented$fn__42089.invoke(util.clj:67)
	at metabase.sync.util$do_sync_operation.invokeStatic(util.clj:164)
	at metabase.sync.util$do_sync_operation.invoke(util.clj:161)
	at metabase.sync.sync_metadata$fn__54462$sync_db_metadata_BANG___54467$fn__54468.invoke(sync_metadata.clj:50)
	at metabase.sync.sync_metadata$fn__54462$sync_db_metadata_BANG___54467.invoke(sync_metadata.clj:47)
	at metabase.api.database$fn__55198$fn__55200.invoke(database.clj:614)
	at clojure.core$binding_conveyor_fn$fn__5754.invoke(core.clj:2030)
	at clojure.lang.AFn.call(AFn.java:18)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

Hi @outlier
Remember to always post “Diagnostic Info” from Admin > Troubleshooting and driver version.
I think you should create an issue on the driver repo. It might be something specific to that driver.
https://github.com/dacort/metabase-athena-driver/issues
Haven’t seen anyone else having this issue, so I don’t think it’s general.

Hi @flamber Thanks for the quick reply. Will create an issue to given github link.
Below is the “Diagnostic Info”.

{
"browser-info": {
"language": "en-GB",
"platform": "MacIntel",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36",
"vendor": "Google Inc."
},
"system-info": {
"file.encoding": "UTF-8",
"java.runtime.name": "Java(TM) SE Runtime Environment",
"java.runtime.version": "1.8.0_171-b11",
"java.vendor": "Oracle Corporation",
"java.vendor.url": "http://java.oracle.com/",
"java.version": "1.8.0_171",
"java.vm.name": "Java HotSpot(TM) 64-Bit Server VM",
"java.vm.version": "25.171-b11",
"os.name": "Linux",
"os.version": "4.14.104-95.84.amzn2.x86_64",
"user.language": "en",
"user.timezone": "Etc/UTC"
},
"metabase-info": {
"databases": [
"athena",
"mysql",
"googleanalytics"
],
"hosting-env": "unknown",
"application-database": "mysql",
"application-database-details": {
"database": {
"name": "MySQL",
"version": "5.7.30"
},
"jdbc-driver": {
"name": "MariaDB Connector/J",
"version": "2.5.1"
}
},
"run-mode": "prod",
"version": {
"tag": "v0.36.0",
"date": "2020-07-21",
"branch": "release-0.36.x",
"hash": "b31049f"
},
"settings": {
"report-timezone": "Asia/Calcutta"
}
}
}

@outlier Not related to this issue, but I would highly suggest that you update Java.
I would recommend AdoptOpenJDK’s JRE 11:
https://adoptopenjdk.net/releases.html?variant=openjdk11&jvmVariant=hotspot

@flamber Thanks. Will update the Java.
Regarding db sync issue, we were not getting this error in older version of the metabase and started getting the issue after upgrading. So I don’t think this can be driver issue.

1 Like

@outlier The underlying schema has changed in 0.36.0, which now has several new columns like database_position. But it’s up to the driver to tell Metabase about some information.
Just like in version 0.34.0 that added some timezone changes, which required the drivers to release new versions to support that.
I’m still checking if there’s something we can change in Metabase, so the sync will fail gracefully.

1 Like

@outlier Just got a confirmation - all drivers need to return database_position since 0.36 - we forgot to notify the developers who are signed up on the driver mailing list, but that will be done shortly.

Thanks @flamber
Please let me know if I need to do anything from my side to update athena driver developers. Also, do you know, by when can we expect this issue to be resolved ?

:wave: Athena driver author (and Metabase employee) here. I’ve created an issue in the Athena driver repo. Feel free to upvote, but I intend to get to this within the next week or two.

1 Like

That’s awesome! Thanks a lot @dacort :slightly_smiling_face: