dimitri / pgloader

Migrate to PostgreSQL in a single command!
http://pgloader.io
Other
5.47k stars 551 forks source link

Not clear how to transfer just one table from MySQL to PostgreSQL; #847

Closed tomekit closed 6 years ago

tomekit commented 6 years ago

I am migrating data from MySQL to PostgreSQL using pgloader Docker command.

docker run --rm --name pgloader --net app-network dimitri/pgloader pgloader --with="quote identifiers" mysql://root:example@host-mysql/sourcedb postgresql://postgres:example@host-postgres/destdb

Unfortunately I've no idea how to transfer just one particular table from MySQL.

Documentation: https://pgloader.readthedocs.io/en/latest/ref/mysql.html#mysql-database-source-specification-from

seem to mention:

If the connection URI contains a table name, then only this table is migrated from MySQL to PostgreSQL.

See the SOURCE CONNECTION STRING section above for details on how to write the connection string.

Above implies that it is possible to transfer just a table, however I couldn't find an info how to pass table in the URI.

I would appreciate pointing me in any direction. Running:

pgloader version "3.4.2~devel"
compiled with SBCL 1.3.14.debian

EDIT: I assume that connection string comes from JDBC. More about JDBC: https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-configuration-properties.html However I can't see any table filtering param.

dimitri commented 6 years ago

Have a look at the docs about the INCLUDING ONLY clause of the LOAD command: https://pgloader.readthedocs.io/en/latest/ref/mysql.html#mysql-partial-migration

tomekit commented 6 years ago

Thanks Dimitri. Is there any chance to specify the: INCLUDING ONLY in the CLI similarly to the --with or --cast flags?

dimitri commented 6 years ago

That's not implemented at this time, and it would be quite a good first PR to pgloader if you want to see about contributing!