Skip to content

Commit

Permalink
Adding new Duckdb read functions
Browse files Browse the repository at this point in the history
* Added `read_parquet(path TEXT[])` function that can be used to read
  multiple parquet files. Argument for this function should be provided
  in PostgreSQL syntax. To read multiple parquet files function should
  be called with argument `ARRAY['...','...']`.

* Added `read_csv(path TEXT)` and `read_parquet(path TEXT[])` reading
  single and multiple CSV files.
  • Loading branch information
mkaruza committed May 24, 2024
1 parent 2f279fb commit b111727
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion quack--0.0.1.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,30 @@ CREATE OR REPLACE FUNCTION read_parquet(path text)
RETURNS SETOF record LANGUAGE 'plpgsql' AS
$func$
BEGIN
RETURN QUERY EXECUTE 'SELECT 1';
RAISE EXCEPTION 'Function `read_parquet(TEXT)` only works with Duckdb execution.';
END;
$func$;

CREATE OR REPLACE FUNCTION read_parquet(path text[])
RETURNS SETOF record LANGUAGE 'plpgsql' AS
$func$
BEGIN
RAISE EXCEPTION 'Function `read_parquet(TEXT[])` only works with Duckdb execution.';
END;
$func$;

CREATE OR REPLACE FUNCTION read_csv(path text)
RETURNS SETOF record LANGUAGE 'plpgsql' AS
$func$
BEGIN
RAISE EXCEPTION 'Function `read_csv(TEXT)` only works with Duckdb execution.';
END;
$func$;

CREATE OR REPLACE FUNCTION read_csv(path text[])
RETURNS SETOF record LANGUAGE 'plpgsql' AS
$func$
BEGIN
RAISE EXCEPTION 'Function `read_csv(TEXT[])` only works with Duckdb execution.';
END;
$func$;

0 comments on commit b111727

Please sign in to comment.