I started experimenting with metabase recently using the metabase.jar file. I connected it to my cloud postgres database and started creating some questions and organised the dashboard.
Now I need to migrate these data to metabase heroku deployment, which I need to contain the same connected database and reports I created locally.
I checked some posts that says that there is only way by using enterprise serialization option. Is not there any other workarounds that may help?
Hi @Raamyy
So you are using Postgres as the Metabase application database (not data source) for your local setup? Post "Diagnostic Info" from Admin > Troubleshooting if you're in doubt.
Then you would just create a setup on Heroku and then migrate the Postgres to Heroku's Postgres using whatever tools you normally use to clone a database (example pg_dump). And then you startup the Heroku Metabase instance. Remember to change the Site URL in Metabase > Admin > Settings > General.
Serialization is not meant for such operations, where you just want to copy an entire application database.
@Raamyy Okay, so you're using H2 as the application database.
You would then just use the built-in migration from H2 to Postgres/MySQL: https://www.metabase.com/docs/latest/operations-guide/migrating-from-h2.html
Since you're using Windows, then you define environment variables with set instead of export, for MB_DB_HOST you would point to your Heroku database.
Then it would migrate everything from your local H2 to your Heroku Postgres.
These above variables should be filled with the data from the heroku deployment above. Is this correct?
I did that and ran the command java -jar metabase.jar load-from-h2 metabase.db
but this error occured
clojure.lang.ExceptionInfo: ERROR Set up postgres target database and run migrations... {}
at metabase.cmd.copy$do_step$fn__77870.invoke(copy.clj:33)
at metabase.cmd.copy$do_step.invokeStatic(copy.clj:29)
at metabase.cmd.copy$do_step.invoke(copy.clj:27)
at metabase.cmd.copy$fn__78031$copy_BANG___78036$fn__78037.invoke(copy.clj:268)
at metabase.cmd.copy$fn__78031$copy_BANG___78036.invoke(copy.clj:256)
at metabase.cmd.load_from_h2$load_from_h2_BANG_.invokeStatic(load_from_h2.clj:35)
at metabase.cmd.load_from_h2$load_from_h2_BANG_.invoke(load_from_h2.clj:25)
at clojure.lang.Var.invoke(Var.java:384)
at metabase.cmd$load_from_h2.invokeStatic(cmd.clj:45)
at metabase.cmd$load_from_h2.invoke(cmd.clj:39)
at clojure.lang.AFn.applyToHelper(AFn.java:154)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invokeStatic(core.clj:665)
at clojure.core$apply.invoke(core.clj:660)
at metabase.cmd$run_cmd$fn__77588.invoke(cmd.clj:191)
at metabase.cmd$run_cmd.invokeStatic(cmd.clj:191)
at metabase.cmd$run_cmd.invoke(cmd.clj:187)
at clojure.lang.Var.invoke(Var.java:388)
at metabase.core$run_cmd.invokeStatic(core.clj:141)
at metabase.core$run_cmd.invoke(core.clj:139)
at metabase.core$_main.invokeStatic(core.clj:163)
at metabase.core$_main.doInvoke(core.clj:158)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at metabase.core.main(Unknown Source)
Caused by: clojure.lang.ExceptionInfo: Unable to connect to Metabase postgres DB. {}
at metabase.db.setup$fn__35702$verify_db_connection__35707$fn__35708$fn__35709.invoke(setup.clj:102)
at metabase.db.setup$fn__35702$verify_db_connection__35707$fn__35708.invoke(setup.clj:100)
at metabase.db.setup$fn__35702$verify_db_connection__35707.invoke(setup.clj:94)
at metabase.db.setup$setup_db_BANG_$fn__35737$fn__35738.invoke(setup.clj:142)
at metabase.util$do_with_us_locale.invokeStatic(util.clj:683)
at metabase.util$do_with_us_locale.invoke(util.clj:669)
at metabase.db.setup$setup_db_BANG_$fn__35737.invoke(setup.clj:141)
at metabase.db.setup$setup_db_BANG_.invokeStatic(setup.clj:140)
at metabase.db.setup$setup_db_BANG_.invoke(setup.clj:136)
at metabase.cmd.copy$fn__78031$copy_BANG___78036$fn__78037$fn__78040.invoke(copy.clj:270)
at metabase.cmd.copy$do_step$fn__77870.invoke(copy.clj:30)
... 23 more
Caused by: org.postgresql.util.PSQLException: FATAL: database "ezd*******" does not exist
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2553)
at org.postgresql.core.v3.QueryExecutorImpl.readStartupMessages(QueryExecutorImpl.java:2665)
at org.postgresql.core.v3.QueryExecutorImpl.<init>(QueryExecutorImpl.java:147)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:273)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:51)
at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:225)
at org.postgresql.Driver.makeConnection(Driver.java:465)
at org.postgresql.Driver.connect(Driver.java:264)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at clojure.java.jdbc$get_driver_connection.invokeStatic(jdbc.clj:271)
at clojure.java.jdbc$get_driver_connection.invoke(jdbc.clj:250)
at clojure.java.jdbc$get_connection.invokeStatic(jdbc.clj:411)
at clojure.java.jdbc$get_connection.invoke(jdbc.clj:274)
at clojure.java.jdbc$db_query_with_resultset_STAR_.invokeStatic(jdbc.clj:1111)
at clojure.java.jdbc$db_query_with_resultset_STAR_.invoke(jdbc.clj:1093)
at clojure.java.jdbc$query.invokeStatic(jdbc.clj:1182)
at clojure.java.jdbc$query.invoke(jdbc.clj:1144)
at clojure.java.jdbc$query.invokeStatic(jdbc.clj:1160)
at clojure.java.jdbc$query.invoke(jdbc.clj:1144)
at metabase.driver.sql_jdbc.connection$can_connect_with_spec_QMARK_.invokeStatic(connection.clj:201)
at metabase.driver.sql_jdbc.connection$can_connect_with_spec_QMARK_.invoke(connection.clj:198)
at metabase.db.setup$fn__35702$verify_db_connection__35707$fn__35708$fn__35709.invoke(setup.clj:100)
... 33 more
Command failed with exception: ERROR Set up postgres target database and run migrations...