duckdb_spatial icon indicating copy to clipboard operation
duckdb_spatial copied to clipboard

Backups (Export / Import) of tables with spatial types do not work.

Open michael-simons opened this issue 2 years ago • 2 comments

Given

duckdb -s "
install spatial;
load spatial;
create table test(id int, foobar geometry);
insert into test values(1, ST_GeomFromText('POLYGON((1 2,1 4,3 4,3 2,1 2))'));
" test.db

Exporting with Spatial extension loaded as CSV

duckdb -s "
load spatial;
export database 'exp1';
" test.db

duckdb -s "
load spatial;
import database 'exp1';
SELECT * FROM test;
"

Results in

libc++abi: terminating due to uncaught exception of type duckdb::NotImplementedException: Not implemented Error: Deserialize::Geometry type not implemented yet!

Exporting with Spatial extension loaded as Parquet

duckdb -s "
load spatial;
export database 'exp2' (FORMAT PARQUET);
" test.db

duckdb -s "
load spatial;
import database 'exp2';
"

Results in

Error: Conversion Error: Unimplemented type for cast (BLOB -> GEOMETRY)

(Failing earlier than CSV)

CSV export without the spatial extension loaded works

duckdb -s "
export database 'exp3';
" test.db

duckdb -s "
load spatial;
import database 'exp3';
SELECT * FROM test;
"

Parquet does not.

CSV contains the wkt as export data when spatial is loaded, binary otherwise. Seems to be the difference here.

michael-simons avatar Jul 01 '23 09:07 michael-simons

Hi! Thanks for reporting this issue, and sorry that I haven't gotten to it earlier. The csv export/import has been implemented in #172, but not parquet. Ill leave this issue open until I manage to get it working for parquet as well.

Maxxen avatar Nov 03 '23 14:11 Maxxen

Looking forward to try this out! Thanks for taking care!

michael-simons avatar Nov 03 '23 16:11 michael-simons