sync the attached datawarehouse (#49970)
* sync the attached datawarehouse requires either "sync_db" true or a table name it will error ```shell ❯ http post 'localhost:3000/api/notify/db/attached_datawarehouse' x-metabase-apikey:apikey -pb Must provide `sync_db` or a `table_name` to sync ``` It will sync the db when sync_db is true [NOTE: this is outdated. now just omitting the table name will sync the db] ```shell ❯ echo '{"synchronous?": true, "sync_db": true}' | http post 'localhost:3000/api/notify/db/attached_datawarehouse' x-metabase-apikey:apikey -pb { "success": true } ``` It will sync existing tables ```shell ❯ http post 'localhost:3000/api/notify/db/attached_datawarehouse' table_name=existing schema_name=public x-metabase-apikey:apikey -pb { "success": true } ``` it will error if it cannot find a table ```shell ❯ http post 'localhost:3000/api/notify/db/attached_datawarehouse' table_name=new schema_name=public x-metabase-apikey:apikey -pb { "cause": "Unable to identify table 'public.new'", "data": { "schema_name": "public", "status-code": 404, "table_name": "new" }, "message": "Unable to identify table 'public.new'", "schema_name": "public", "table_name": "new", "trace": [], "via": [ { "data": { "schema_name": "public", "status-code": 404, "table_name": "new" }, "message": "Unable to identify table 'public.new'", "type": "clojure.lang.ExceptionInfo" } ] } ``` if i create that table ```sql attached=# create table new (id int); CREATE TABLE ``` it will then find and sync it ```shell ❯ http post 'localhost:3000/api/notify/db/attached_datawarehouse' table_name=new schema_name=public x-metabase-apikey:apikey -pb { "success": true } ``` * formatting * Tests for attached datawarehouse * PR nits typo in `thorw` -> `throw` comment explaining why `find-and-sync-new-table` is always sync gensym the db name in test remove a binding for a fn `sync!` that's only called once test `{:sync_db true}` syncs the whole db * stupid formatting* Use absence of table_name as indicator to sync database
Please register or sign in to comment