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

Unimplemented type for cast (INTERVAL -> TIME) #7

Open
guenp opened this issue Mar 11, 2024 · 6 comments · Fixed by #26 or duckdb/duckdb-odbc#2
Open

Unimplemented type for cast (INTERVAL -> TIME) #7

guenp opened this issue Mar 11, 2024 · 6 comments · Fixed by #26 or duckdb/duckdb-odbc#2
Labels
bug Something isn't working

Comments

@guenp
Copy link
Collaborator

guenp commented Mar 11, 2024

In the ODBC spec (see sqlext.h), the data type INTERVAL has the same data type identifier as TIME. When casting a DuckDB INTERVAL to an ODBC INTERVAL, I get the following error:

ODBC: ERROR [22007] ODBC_DuckDB->GetDataStmtResult Not implemented Error: Unimplemented type for cast (INTERVAL -> TIME)

Repro steps:

  1. Create a new DuckDB database with an INTERVAL variable:
create or replace table test AS (
    select
        x * (INTERVAL 5 HOUR) as customer_interval_field
    from generate_series(1, 10) g(x)
);
  1. Load the data into Power Query with the following script:
let
    Database = "path\to\test.db",
    OdbcDatasource = DuckDB.Contents(Database)
in
    OdbcDatasource{[Item="test"]}[Data]
  1. This throws the error:
ODBC: ERROR [22007] ODBC_DuckDB->GetDataStmtResult Not implemented Error: Unimplemented type for cast (INTERVAL -> TIME)

This may need to be addressed in the DuckDB ODBC driver.

Related to #5 .

@guenp guenp added the bug Something isn't working label Mar 11, 2024
@guenp
Copy link
Collaborator Author

guenp commented Mar 11, 2024

A similar error when using a TIME field:

ODBC: ERROR [22007] ODBC_DuckDB->GetDataStmtResult Not implemented Error: Unimplemented type for cast (TIME -> DATE)

@guenp
Copy link
Collaborator Author

guenp commented Mar 13, 2024

Similar issue when using UUID field:

Unimplemented type for cast (UUID -> DOUBLE)

@guenp
Copy link
Collaborator Author

guenp commented Mar 13, 2024

There was a related workaround needed for the Tableau connector: https://github.com/MotherDuck-Open-Source/duckdb-tableau-connector/blob/main/tableau_connectors/duckdb_jdbc/dialect.tdd

@guenp
Copy link
Collaborator Author

guenp commented Mar 14, 2024

Here is a related issue with TIMESTAMP that I was able to reproduce: duckdb/duckdb#9963

@guenp
Copy link
Collaborator Author

guenp commented May 14, 2024

@guenp
Copy link
Collaborator Author

guenp commented May 16, 2024

Most recent screenshot post-fix (also casting UUID to VARCHAR):
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant