-
-
Notifications
You must be signed in to change notification settings - Fork 585
Description
Description
I’m migrating data from an existing SQLite database into a PostgreSQL database using pgloader
.
My PostgreSQL target database already has some tables created by Alembic migrations (for example, alembic_version
).
When I run pgloader, it attempts to create all tables from SQLite, even if they already exist in PostgreSQL.
This causes errors like:
ERROR Database error 42P07: relation "alembic_version" already exists
QUERY: CREATE TABLE alembic_version
(
version_num text
);
FATAL Failed to create the schema, see above.
Steps to Reproduce
- Create a PostgreSQL database with an existing table, e.g.:
CREATE TABLE alembic_version (version_num TEXT);
- Run pgloader:
pgloader sqlite:///source.db postgresql://user:pass@host:5432/target
- pgloader fails because it tries to
CREATE TABLE alembic_version
again.
Expected Behavior
There should be a way to:
- Import data into existing PostgreSQL tables without re-creating them.
- Or explicitly exclude some tables (like
alembic_version
) from schema creation, while still importing the rest.
What I Tried
- Adding
WITH include no drop
→ still attempts to create tables. - Adding
no create tables
underWITH
→ parse error (ESRAP-PARSE-ERROR
). - Excluding tables with
EXCLUDING TABLE NAMES MATCHING ~/alembic_version/
also didn’t work as expected (still tries to create schema).
Environment
- pgloader version:
3.6.7~devel
Question / Feature Request
Is there a supported way to only load data into existing schema without pgloader trying to re-create tables?
If not, could we add a no create tables
option or make EXCLUDING TABLE NAMES
skip schema creation for those tables?
pgloader fails when target DB already has existing tables (alembic_version already exists
)
Description
I’m migrating data from an existing SQLite database into a PostgreSQL database using pgloader
.
My PostgreSQL target database already has some tables created by Alembic migrations (for example, alembic_version
).
When I run pgloader, it attempts to create all tables from SQLite, even if they already exist in PostgreSQL.
This causes errors like:
ERROR Database error 42P07: relation "alembic_version" already exists
QUERY: CREATE TABLE alembic_version
(
version_num text
);
FATAL Failed to create the schema, see above.
Steps to Reproduce
- Create a PostgreSQL database with an existing table, e.g.:
CREATE TABLE alembic_version (version_num TEXT);
- Run pgloader:
pgloader sqlite:///source.db postgresql://user:pass@host:5432/target
- pgloader fails because it tries to
CREATE TABLE alembic_version
again.
Expected Behavior
There should be a way to:
- Import data into existing PostgreSQL tables without re-creating them.
- Or explicitly exclude some tables (like
alembic_version
) from schema creation, while still importing the rest.
What I Tried
- Adding
WITH include no drop
→ still attempts to create tables. - Adding
no create tables
underWITH
→ parse error (ESRAP-PARSE-ERROR
). - Excluding tables with
EXCLUDING TABLE NAMES MATCHING ~/alembic_version/
also didn’t work as expected (still tries to create schema).
Environment
- pgloader version:
3.6.7~devel
Question / Feature Request
Is there a supported way to only load data into existing schema without pgloader trying to re-create tables?
If not, could we add a no create tables
option or make EXCLUDING TABLE NAMES
skip schema creation for those tables?