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

Loader functions with temp tables. #7214

Open
johnfouf opened this issue Jan 5, 2022 · 2 comments
Open

Loader functions with temp tables. #7214

johnfouf opened this issue Jan 5, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@johnfouf
Copy link

johnfouf commented Jan 5, 2022

Describe the bug
I am not sure if this is a bug or a feature request. It seems that python loader functions work also with temporary tables in case I first create the table and then copy into it from loader function. However, it does not work if I try to create temp table from loader function.

To Reproduce

BEGIN TRANSACTION;
CREATE TEMP TABLE test_table(a INT) on commit drop;
CREATE OR REPLACE LOADER myloader(c INT) LANGUAGE PYTHON {
_emit.emit( { 'a' : c+1 } )
};
COPY LOADER INTO test_table FROM myloader((select 5));
select * from test_table;
COMMIT;

The above flow works and returns 6

Using this syntax:
sql> CREATE TEMP TABLE TEST1 from LOADER myloader((select 5));
syntax error in: "create temp table test1 from"

However this syntax is allowed for persistent tables:
sql> CREATE TABLE TEST1 from LOADER myloader((select 5));
operation successful

It seems that loader functions can be used to load temporary tables, but this is not supported by the parser.

@PedroTadim
Copy link
Contributor

Someone in the mailing list asked for this sometime ago. I consider this as a missing feature.

@johnfouf
Copy link
Author

johnfouf commented Jan 5, 2022

It was me, at that time I had a previous version of MonetDB (don't remember exactly which version). Loader functions did not work even with precreated temp tables. Now with the latest version they work if you first create and then copy into so I feel that the functionality exists.

@PedroTadim PedroTadim added the enhancement New feature or request label Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants