pgloader icon indicating copy to clipboard operation
pgloader copied to clipboard

Regarding passing custom cast in pgloader while running through docker container

Open vduttadev opened this issue 6 years ago • 1 comments

I am really impressed with this and would like to contribute if possible anyway. Right now I just need one help I couldn't find out this anywhere in the documentation. How can I use --cast argument if I am running it through docker like I am able to run it run it by following LISP way like LOAD DATABASE FROM mysql://xxxxxxxx INTO pgsql://yyyyy

alter schema 'abc' rename to 'public'

CAST type datetime to timestamp
           drop default drop not null using zero-dates-to-null,
     type date to date drop not null drop default using zero-dates-to-null,
     type char when (>= precision 2) to varchar keep typemod

but if I want to use the same cast while running from using docker like
docker run --rm --name pgloader --net=host dimitri/pgloader:latest pgloader --debug --verbose --cast mysql://xxxxxxxx pgsql://yyyyyyy . Here how can I pass the above cast rules. I tried all the ways like putting them in single quotes, double quotes etc but it gives error

So if anyone has any idea please let me know

vduttadev avatar Nov 22 '19 07:11 vduttadev

You can provide multiple cast rules by using the "--cast" option multiple times like this :

docker run --rm --name pgloader --net=host dimitri/pgloader:latest pgloader --debug --verbose \
--cast "type datetime to timestamp drop default drop not null using zero-dates-to-null" \
--cast "type date to date drop not null drop default using zero-dates-to-null" \
--cast "type char when (>= precision 2) to varchar keep typemod" \
mysql://xxxxxxxx pgsql://yyyyyyy

I think this issue can be closed ;)

gcavelier avatar Aug 21 '23 11:08 gcavelier