Get referential integrity (PK/FK)

Hi Dremians,
Apache Calcite provides the capability to get primary / foreign keys:

I tested it and function getPrimaryKeys does not fail, but it does not provide primary keys stored in the database.
I test it against Postgres data source.

    private fun primaryKeys(jdbcConnection: Connection, tableName: String) {
        val resultSetPk = jdbcConnection.metaData.getPrimaryKeys(
            "DREMIO",
            "postgres_local_docker.tpch",
            "lineitem"
        )
        while (resultSetPk.next()) {
            val pkColumnName = resultSetPk.getString("COLUMN_NAME")
            println("- primaryKey: $pkColumnName")
        }
    }

Should this work?
If not, is it on your radar?

Jan

@jacek

Currently no, usually the source RDBMS should be able to do it, like in Oracle user_constraints

Hi @balaji.ramaswamy
Do we have a way to get Primary and Foreign Key relationships of actual sources via Dremio ? Please post the supported table Or any query for this. Thank You.

@VinodMerugu Are you asking if via Dremio we can pull PK/FK relationships on source database like Oracle? Unfortunately we cannot

1 Like