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

Support for DuckDB? #48

Closed
TheCedarPrince opened this issue Jan 22, 2024 · 5 comments
Closed

Support for DuckDB? #48

TheCedarPrince opened this issue Jan 22, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@TheCedarPrince
Copy link
Contributor

Hi @xitology and @clarkevans !

I was wondering, would it be possible to support DuckDB syntax here? I had read the syntax was very similar to PostgreSQL, so I ran OHDSICohortExpressions with the model flavor set to PostgreSQL but I got an error that looked like this

julia> DBInterface.execute(conn, queries[3] |> String)
ERROR: Binder Error: No function matches the given name and argument types '+(DATE, BIGINT)'. You might need to add explicit type casts.
        Candidate functions:
        +(TINYINT) -> TINYINT
        +(TINYINT, TINYINT) -> TINYINT
        +(SMALLINT) -> SMALLINT
        +(SMALLINT, SMALLINT) -> SMALLINT
        +(INTEGER) -> INTEGER
        +(INTEGER, INTEGER) -> INTEGER
        +(BIGINT) -> BIGINT
        +(BIGINT, BIGINT) -> BIGINT
        +(HUGEINT) -> HUGEINT
        +(HUGEINT, HUGEINT) -> HUGEINT
        +(FLOAT) -> FLOAT
        +(FLOAT, FLOAT) -> FLOAT
        +(DOUBLE) -> DOUBLE
        +(DOUBLE, DOUBLE) -> DOUBLE
        +(DECIMAL) -> DECIMAL
        +(DECIMAL, DECIMAL) -> DECIMAL
        +(UTINYINT) -> UTINYINT
        +(UTINYINT, UTINYINT) -> UTINYINT
        +(USMALLINT) -> USMALLINT
        +(USMALLINT, USMALLINT) -> USMALLINT
        +(UINTEGER) -> UINTEGER
        +(UINTEGER, UINTEGER) -> UINTEGER
        +(UBIGINT) -> UBIGINT
        +(UBIGINT, UBIGINT) -> UBIGINT
        +(DATE, INTEGER) -> DATE
        +(INTEGER, DATE) -> DATE
        +(INTERVAL, INTERVAL) -> INTERVAL
        +(DATE, INTERVAL) -> DATE
        +(INTERVAL, DATE) -> DATE
        +(TIME, INTERVAL) -> TIME
        +(INTERVAL, TIME) -> TIME
        +(TIMESTAMP, INTERVAL) -> TIMESTAMP
        +(INTERVAL, TIMESTAMP) -> TIMESTAMP
        +(TIME, DATE) -> TIMESTAMP
        +(DATE, TIME) -> TIMESTAMP
        +(ANY[], ANY[]) -> ANY[]

I could give my whole SQL expression for what I am trying but am curious if there'd ever be interest to support DuckDB. Thanks!

@xitology
Copy link
Member

DuckDB should work with FunSQL if you use SQLite dialect, but there's no support for it in OHDSICohortExpressions. If you want DuckDB support in OHDSICohortExpressions, please open an issue there.

@andreypopp
Copy link

DuckDB should work with FunSQL if you use SQLite dialect

probably PostgreSQL dialect though? they use PostgreSQL parser (with some extensions now)

@xitology
Copy link
Member

DuckDB should work with FunSQL if you use SQLite dialect

probably PostgreSQL dialect though? they use PostgreSQL parser (with some extensions now)

Good point. When I tried DuckDB with FunSQL, I used SQLite dialect, but it wasn't a comprehensive testing, so it may fail in some corner cases of SQL grammar. I suppose, DuckDB deserves its own dialect.

@TheCedarPrince
Copy link
Contributor Author

Ah gotcha -- I'll open an issue over in OHDSICohortExpressions.jl as well. Thanks @xitology ! 😄

@clarkevans clarkevans added the enhancement New feature or request label Feb 26, 2024
@clarkevans clarkevans changed the title [FEATURE] Support for DuckDB? Support for DuckDB? Feb 26, 2024
@xitology
Copy link
Member

Added in #69

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

4 participants