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

Sync index info: sqlserver and sqlite #36665

Merged
merged 9 commits into from
Dec 14, 2023

Conversation

qnkhuat
Copy link
Contributor

@qnkhuat qnkhuat commented Dec 12, 2023

Milestone 3 of #36452

These 2 drivers are JDBC drivers so it already works, this PR is mostly about making the tests work properly

After this we should be done syncing index info for all the drivers that support it

@metabase-bot metabase-bot bot added the .Team/BackendComponents also known as BEC label Dec 12, 2023
@qnkhuat qnkhuat added the no-backport Do not backport this PR to any branch label Dec 12, 2023
@qnkhuat qnkhuat changed the title Sync index info tier 4 Sync index info: sqlserver and sqlite Dec 12, 2023
@qnkhuat qnkhuat requested a review from a team December 12, 2023 08:45
@calherries
Copy link
Contributor

Looks like there's a few sqlite tests failing, I'm not sure why though because they seem unrelated.

Copy link

cypress bot commented Dec 14, 2023

1 flaky test on run #188 ↗︎

0 2170 162 0 Flakiness 1

Details:

Sync index info: sqlserver and sqlite
Project: Metabase e2e Commit: 23a6365c3f
Status: Passed Duration: 17:23 💡
Started: Dec 14, 2023 11:05 AM Ended: Dec 14, 2023 11:22 AM
Flakiness  e2e/test/scenarios/native/native_subquery.cy.spec.js • 1 flaky test • flaky

View Output

Test Artifacts
scenarios > question > native subquery > should be able to reference a saved native question that ends with a semicolon `;` (metabase#28218) Test Replay Screenshots

Review all test suite changes for PR #36665 ↗︎

;; In sqlite a PK will implicitly have a UNIQUE INDEX, but if the PK is integer the getIndexInfo method from
;; jdbc doesn't return it as indexed. so we need to manually get mark the pk as indexed here
(cond-> ((get-method driver/describe-table-indexes :sql-jdbc) driver database table)
(string? pk)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why string?? What other type could pk be?

Suggested change
(string? pk)
(string? pk)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nil

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then ideally you should use some? instead for readability. When I read this, I was questioning why such a specific check was made, and wondering whether the pk could be something other than a string, and then wondering why we would only add pks that were strings and not other types. It doesn't help that get-table-pks's docstring doesn't mention the return type.

src/metabase/driver/sql_jdbc/sync/describe_table.clj Outdated Show resolved Hide resolved
Copy link
Contributor

@calherries calherries left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@qnkhuat qnkhuat merged commit 925bb0f into ngoc-sync-index-info-mongo Dec 14, 2023
58 checks passed
@qnkhuat qnkhuat deleted the ngoc-sync-index-info-tier-4 branch December 14, 2023 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-backport Do not backport this PR to any branch .Team/BackendComponents also known as BEC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants