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

Error for new connections #8

Closed
imaurer opened this issue Oct 26, 2022 · 4 comments
Closed

Error for new connections #8

imaurer opened this issue Oct 26, 2022 · 4 comments

Comments

@imaurer
Copy link

imaurer commented Oct 26, 2022

Thanks for this project. I am running into an issue and I am unsure if it is my fault.

Trying to access parquet files via duckdb and for each new connection, I have to re-run duckdb_execute to get the query to work.

Here is my setup:

CREATE EXTENSION duckdb_fdw;

CREATE SERVER DuckDB_server
FOREIGN DATA WRAPPER duckdb_fdw;

SELECT duckdb_execute(
	'duckdb_server',
	'create or replace view markers as select * from parquet_scan(''/var/annotations/samples/*.parquet'');'
);

CREATE SCHEMA parquet;

IMPORT FOREIGN SCHEMA public
             limit to (markers) 
          FROM SERVER duckdb_server
                 INTO parquet;

select * from parquet.markers limit 100;

This last query works great. However, on creating a new connection, the final SELECT statement fails.

ERROR:  SQL error during prepare: Catalog Error: Table with name markers does not exist!
Did you mean "duckdb_views"?
LINE 1: ... "is_phased", "is_het", "quality" FROM main."markers"
^ SELECT "hgvs_g", "total_depth", "alt_depth", "ref_depth", "vaf", "vaf_alt", "sample_name", "is_phased", "is_het", "quality" FROM main."markers".

I notice the schema says main in the error message. If I run the following in a NEW connection, it works great:

SELECT duckdb_execute(
	'duckdb_server',
	'create or replace view markers as select * from parquet_scan(''/var/annotations/samples/*.parquet'');'
);

select * from parquet.markers limit 100;

Using Postgres 14 in an Alpine Docker instance. Let me know if there are any other details required.

Thanks in advance, Ian

@alitrack
Copy link
Owner

CREATE SERVER DuckDB_server
FOREIGN DATA WRAPPER duckdb_fdw;

means you create a duckdb in memory, so it will lost after disconnect.

@imaurer
Copy link
Author

imaurer commented Oct 27, 2022

Thanks for the insight. Going to switch to the parquet_fdw for my use case. I appreciate the response!

@imaurer imaurer closed this as completed Oct 27, 2022
@alitrack
Copy link
Owner

@imaurer
but you can give a database name, for example,

CREATE SERVER DuckDB_server FOREIGN DATA WRAPPER duckdb_fdw OPTIONS (database '/tmp/test.db');

then when connect next time, it will keep

@imaurer
Copy link
Author

imaurer commented Oct 27, 2022

Thanks for the clarification!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants