Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impossible to export sqlite to duckdb keeping constraints. "information_schema.table_constraints" waiting for a memory use. #115

Open
2 tasks done
Victordeleusse opened this issue Sep 6, 2024 · 1 comment

Comments

@Victordeleusse
Copy link

Victordeleusse commented Sep 6, 2024

What happens?

I try to ATTACH a sqlite db but impossible to export constraints as primary and foreign keys.

To Reproduce

Working on an attached sqlite database :

con = duckdb.connect()
con.execute("ATTACH 'california_schools.sqlite' as cs (TYPE sqlite)")
con.execute("USE cs")
res = con.execute("SELECT * FROM information_schema.table_constraints").fetchall()
print(res)

Here an error occured

CatalogException                          Traceback (most recent call last)

Cell In[187], line 1

----> 1 res = con.execute("SELECT * FROM information_schema.table_constraints").fetchall()

      2 print(res)

 

CatalogException: Catalog Error: Table with name table_constraints does not exist!

Did you mean "memory.information_schema.table_constraints"?

LINE 1: SELECT * FROM information_schema.table_constraints

When adding it and using it as requiered, the return list is empty whereas constraints keys well exist in database, so it seems that the constraints are not export from sqlite to DuckDB (as the command ALTER TABLE is still not functionnal in DuckDB it seems make sens). So how to face off this issue ? And how to allow exporting an sqlite db to a duckdb one keeping constraints and metadata ?

Thank you.

OS:

x86_64

DuckDB Version:

latest

DuckDB Client:

Python

Hardware:

No response

Full Name:

Victor de Leusse

Affiliation:

42

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have tested with a stable release

Did you include all relevant data sets for reproducing the issue?

Not applicable - the reproduction does not require a data set

Did you include all code required to reproduce the issue?

  • Yes, I have

Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?

  • Yes, I have
@szarnyasg
Copy link
Contributor

Thanks! Here's a plain SQL reproducer on sakila.db:

ATTACH 'sakila.db' as cs (TYPE sqlite);
USE cs;
SELECT * FROM information_schema.table_constraints;

@szarnyasg szarnyasg transferred this issue from duckdb/duckdb Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants