I am trying to import a table from Postgresql to a Parquet file on HDFS.
Here is what I do:
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
does not work indeed, but SELECT t.* FROM foo.bar AS t LIMIT 1
does. So the problem is that table name is quoted. I tried supplying --table
argument different ways, but with no effect.
How do I work it around?
EDIT
As the docs you linked state, there is a --schema
argument. For some reason it is not mentioned in sqoop help import
.
Another weird thing is that
--table bar --schema foo
still does not work, but
--table bar -- --schema foo
does.
Anyway, it works now. Thanks for linking the relevant docs section!