Sqoop + Postgresql: how to prevent quotes around table name
I am trying to import a table from Postgresql to a Parquet file on HDFS.
That's what I'm doing:
sqoop import \
--connect "jdbc:postgresql://pg.foo.net:5432/bar" \
--username user_me --password $PASSWORD \
--table foo.bar \
--target-dir /user/me/bar \
--as-parquetfile
and i get
INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM "foo.bar" AS t LIMIT 1
ERROR manager.SqlManager: Error executing statement: org.postgresql.util.PSQLException: ERROR: relation "foo.bar" does not exist
SELECT t.* FROM "foo.bar" AS t LIMIT 1
doesn't work but SELECT t.* FROM foo.bar AS t LIMIT 1
does. So the problem is that the table name is being quoted. I tried to provide arguments in --table
various ways, but with no effect.
How should I do it?
EDIT
There is an argument as the document associated with the state --schema
. For some reason this is not mentioned in the sqoop help import
.
Another strange thing:
--table bar --schema foo
still doesn't work but
--table bar -- --schema foo
does.
Anyway, it works now. Thanks for the link to the relevant section of the documents!
source to share
According to the documentation, you need to specify the schema separately:
sqoop import \
--connect "jdbc:postgresql://pg.foo.net:5432/bar" \
--username user_me --password $PASSWORD \
--table bar \
--schema foo \
--target-dir /user/me/bar \
--as-parquetfile
source to share