prql icon indicating copy to clipboard operation
prql copied to clipboard

Support Oracle's SQL dialect

Open Barney-x1 opened this issue 3 years ago • 4 comments
trafficstars

I did a double take when I saw the list of supported (/to-be-supported) SQL dialects.

A quick search for "database market share" will take you to multiple sources which confirm that not only is Oracle the most-used database, it has 100+ times the user base of some of the to-be-supported databases.

Am I missing something?

Barney-x1 avatar Sep 14 '22 12:09 Barney-x1

We inherit this from sqlparser-rs, this isn't meant as a normative statement!

Note that the generic dialect will work for most things; this is only needed for dialect-specific SQL.

Please feel free to open an issue there if Oracle would be helpful.

Thanks @Barney-x1

max-sixty avatar Sep 14 '22 15:09 max-sixty

I don't really understand the dependency. Surely sqlparser-rs consumes SQL, whereas PRQL generates it?

Barney-x1 avatar Sep 14 '22 16:09 Barney-x1

sqlparser-rs also creates it! We convert into their ast at https://github.com/prql/prql/blob/0.2.6/prql-compiler/src/sql/translator.rs#L52 and then it writes it out. Does that make sense?

max-sixty avatar Sep 14 '22 19:09 max-sixty

@Barney-x1 I'm not too familiar with Oracle dialect. Can you outline the key differences? Which quotes does it use for strings? Does it use TOP or LIMIT?

Because code produced by prql-compiler uses just a subset of SQL, it is very likely that it will work out of the box, if Oracle's SQL is compliant with ISO/IEC 9075.

Just to be clear, is the dialect called PL/SQL or is it just an extension?

aljazerzen avatar Sep 19 '22 06:09 aljazerzen

I'll close this for the moment, given it relies on a feature upstream. Feel free to reopen if there's something we can do from here.

To reiterate, this is not a normative statement about Oracle. And because the vast majority of PL/SQL overlaps with standard SQL, it's very possible to use PRQL with an Oracle database already.

max-sixty avatar Oct 15 '22 04:10 max-sixty