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

Allow setting geometry type explicitly during layer creation, + misc Bugfixes #249

Merged
merged 10 commits into from
Feb 4, 2024

Conversation

Maxxen
Copy link
Member

@Maxxen Maxxen commented Feb 4, 2024

  • Adds support for writing TIME/DATE/TIMESTAMP etc columns through GDAL
  • Some GDAL drivers will attempt to read from a file without first checking the file type, this broke when trying to read from directories as DuckDB would immediately throw. We now just return 0 bytes read instead, which triggers GDAL to actually inspect the file. This fixes being able to read from the directory path for formats that commonly span multiple files (such as .gdb and .shp), instead of having to find the explicit inner data files.
  • You can now pass a geometry type parameter when copying through GDAL to create a geometry layer of a specific type, which is a requirement for some drivers (e.g. OpenFileGDB) as they don't support mixed geometries.
  • Fixes a bug where column in filters that get pushed down into GDAL were not being properly quoted in the case that they contain spaces or special characters.

Example:

COPY (SELECT ST_Point(1,2) as geom, 10 as i) TO '__TEST_DIR__/test.gdb' WITH (FORMAT 'GDAL', DRIVER 'OpenFileGDB', GEOMETRY_TYPE 'POINT');

Closes #247
Closes #240
Closes #238
Closes #233

@aborruso
Copy link
Contributor

aborruso commented Feb 4, 2024

great PR, thank you

@Maxxen Maxxen merged commit b9a517f into duckdb:main Feb 4, 2024
20 checks passed
@davidjbrennan
Copy link

Hi @Maxxen. I'm using a very recent build (v0.9.3-dev4116) of DuckDB and the issue is still present of a column name, containing spaces, not being properly quoted when the filter gets pushed down to GDAL using st_read against an Excel spreadsheet. When is your fix likely to be included in the main build of DuckDB?

@Maxxen
Copy link
Member Author

Maxxen commented Feb 11, 2024

Next DuckDB release is scheduled for tuesday!

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