The migrate package should support multiple database drivers, not only MySQL

Moved from GitHub dgraph/5644

Posted by johnknapp:

Experience Report

  • Running dgraph migrate on a postgres database fails.

What you wanted to do

  • I wanted a successful migration of a postgres database.
  • I wanted to specify db driver in my config.properties
  • I wanted the migrate package to load and use the correct driver

What you actually did

  • I ran dgraph migrate --config config.properties --output_schema schema.txt --output_data sql.rdf
  • I ran this on a postgres database

Why that wasn’t great, with examples

  • I received error message: driver: bad connection

Any external references to support your case

From dgraph/cmd/migrate/utils.go:32

func getPool(host, port, user, password, db string) (*sql.DB,
	error) {
	return sql.Open("mysql",
		fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?parseTime=true", user, password, host, port, db))
}

@JohnKnapp Did you ever manage to resolve this issue? I am running into the same problem trying to migrate a postgres database.

@hardik what is the status of the postgres migration support?
cc @vvbalaji

We have already started working on a utility which would allow user to migrate their postgres data and will be available in cloud.

1 Like

@hardik Do you have a rough timeline for availability of this feature?

@mbelisle we are targeting around July-21 for this.

1 Like

@hardik is this feature live? I’m doing some research on migration from relational to graph databases.

Not yet.