This repository was archived by the owner on May 7, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 199
fix(ibis): added primary key management on postgres and updated mssql and mysql to manage composite keys #1106
Closed
Closed
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
e159f5a
fix(ibis): added primary key management on postgres and updated mssql…
yalexbadan 0b5eb0a
fix(ibis): runned just for code formatting
yalexbadan bfcd4ed
fix(ibis): fixed tests
yalexbadan 8076da8
fix(ibis): fmt code
goldmedal 7bcce3b
fix(ibis): fixed clickhouse and trino metadata classes
yalexbadan dbff7d8
fix(ibis): fixed test models
yalexbadan 592ed28
fix(ibis): updated java servers with new models
yalexbadan 3238116
fix(ibis): reverted to initial proposal
yalexbadan 2337028
fix(ibis): chagend composed primary key logic
yalexbadan feb19ba
Merge branch 'main' into issues/1105
yalexbadan 10fc6f6
fix(ibis): minor fix on postgres foreign key extraction query
yalexbadan a119b55
fix(ibis): fixed rever issues
yalexbadan 43cef18
fix(ibis): fixed revert issues
yalexbadan 7c8ed81
fix(ibis): fixed revert regressions
yalexbadan 721d978
fix(ibis): fixed revert regressions
yalexbadan e6e7c02
fix(ibis): fixed other revert regressions
yalexbadan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,7 +88,7 @@ def get_table_list(self) -> list[Table]: | |
| catalog="", # Oracle doesn't use catalogs. | ||
| table=row["TABLE_NAME"], | ||
| ), | ||
| primaryKey="", | ||
| primaryKey=[], | ||
| ) | ||
|
|
||
| unique_tables[schema_table].columns.append( | ||
|
|
@@ -100,6 +100,8 @@ def get_table_list(self) -> list[Table]: | |
| properties=None, | ||
| ) | ||
| ) | ||
|
|
||
| # TODO: manage primary key | ||
|
|
||
|
Comment on lines
+104
to
+105
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the comment propose? Could you explain more? |
||
| return list(unique_tables.values()) | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,7 @@ def get_table_list(self) -> list[Table]: | |
| c.data_type, | ||
| c.is_nullable, | ||
| c.ordinal_position, | ||
| tc.constraint_type, | ||
| obj_description(cls.oid) AS table_comment, | ||
| col_description(cls.oid, a.attnum) AS column_comment | ||
| FROM | ||
|
|
@@ -44,6 +45,12 @@ def get_table_list(self) -> list[Table]: | |
| pg_attribute a | ||
| ON a.attrelid = cls.oid | ||
| AND a.attname = c.column_name | ||
| LEFT JOIN information_schema.key_column_usage kcu | ||
| ON c.table_name = kcu.table_name | ||
| AND c.column_name = kcu.column_name | ||
| AND c.table_schema = kcu.table_schema | ||
| LEFT JOIN information_schema.table_constraints tc | ||
| ON kcu.constraint_name = tc.constraint_name | ||
| WHERE | ||
| t.table_type IN ('BASE TABLE', 'VIEW') | ||
| AND t.table_schema NOT IN ('information_schema', 'pg_catalog'); | ||
|
|
@@ -67,7 +74,7 @@ def get_table_list(self) -> list[Table]: | |
| catalog=row["table_catalog"], | ||
| table=row["table_name"], | ||
| ), | ||
| primaryKey="", | ||
| primaryKey=[], | ||
| ) | ||
|
|
||
| # table exists, and add column to the table | ||
|
|
@@ -80,6 +87,10 @@ def get_table_list(self) -> list[Table]: | |
| properties=None, | ||
| ) | ||
|
coderabbitai[bot] marked this conversation as resolved.
Comment on lines
+104
to
112
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible to have multiple primary keys in the same table? IMO, the postgres only allows the table has only one primary key. Given a table |
||
| ) | ||
|
|
||
| if row["constraint_type"] == 'PRIMARY KEY': | ||
| unique_tables[schema_table].primaryKey.append(row["column_name"]) | ||
|
|
||
| return list(unique_tables.values()) | ||
|
|
||
| def get_constraints(self) -> list[Constraint]: | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
❓ Verification inconclusive
Implementation needed for primary key collection.
The TODO comment indicates that the implementation for collecting primary key information is still pending. Unlike the MySQL and MSSQL implementations, there's no code to populate the primaryKey list yet.
The Oracle metadata class needs to be updated to collect primary key information similar to the MySQL and MSSQL implementations. Without this, composite primary keys won't be properly represented for Oracle tables.
Check if there is a related SQL query that can be added to identify primary keys:
🏁 Script executed:
Length of output: 59
Update Oracle Metadata to Properly Handle Primary Keys [Critical]
The Oracle metadata implementation in
ibis-server/app/model/metadata/oracle.py(lines 103–104) still contains a TODO for primary key handling. Unlike the MySQL and MSSQL implementations, this class does not currently populate theprimaryKeylist. This omission means that composite primary keys for Oracle tables may not be properly represented.Suggestions:
ALL_CONSTRAINTSandALL_CONS_COLUMNS) to construct an SQL query that retrieves primary key columns.primaryKeylist in a manner consistent with the other implementations.