apache / arrow-adbc

Database connectivity API standard and libraries for Apache Arrow
https://arrow.apache.org/adbc/
Apache License 2.0
385 stars 97 forks source link

Clarification on GetObjects FOREIGN KEY #2294

Open CurtHagenlocher opened 3 weeks ago

CurtHagenlocher commented 3 weeks ago

What would you like help with?

Is the intent of the FOREIGN KEY constraints returned by AdbcConnectionGetObjects that they include relational constraints in both directions? That is, for a CUSTOMER table defined as in TPC-H, should it return both "ORDERS"."CUSTKEY" (which references "CUSTOMER"."CUSTKEY") and "NATION"."NATIONKEY" (which is referenced by "CUSTOMER"."NATIONKEY")?

If so, the documentation could probably be improved by indicating this explicitly.

If not, if it only returns references in one direction then this is a feature gap with ODBC and JDBC.

lidavidm commented 2 weeks ago

I think from reading the GetObjects schema definition, only JDBC's getImportedKeys is supported, effectively. We would need to add something to cover getExportedKeys, probably by extending the constraint_type (adding EXPORTED KEY?)