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

feat: FIR-33601: use catalogs table instead of databases table if exists #424

Merged
merged 1 commit into from
Jun 19, 2024

Conversation

alexradzin
Copy link
Collaborator

No description provided.

@alexradzin alexradzin requested a review from a team as a code owner June 10, 2024 08:24
"WHERE engs.engine_name = ?";
private static final String DATABASE_QUERY = "SELECT database_name FROM information_schema.databases WHERE database_name=?";
private static final String DATABASE_QUERY = "SELECT %1$s_name FROM information_schema.%1$ss WHERE %1$s_name=?";
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be called IS_QUERY or something? Since it's not only for querying databases

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree that now the name is not good enough, however IMHO IS_QUERY even worse. What about EXISTENCE_QUERY or, probably INVENTORY_QUERY?
But taking in consideration your next comment all this is irrelevant and we just have to use catalogs instead of databases.

Copy link
Contributor

Choose a reason for hiding this comment

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

We can use both suggested names. I'm just thinking to make the naming more general

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Renamed to INVENTORY_QUERY.


public FireboltEngineInformationSchemaService(FireboltConnection fireboltConnection) throws SQLException {
this.fireboltConnection = fireboltConnection;
dbTerm = doesRecordExist(format(DATABASE_QUERY, "table"), "catalogs") ? "catalog" : "table";
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we use databases in case we don't have catalogs? I don't think table makes sense here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I do not know. I tried to be backwards compatible. Do you think that we should just forget about the databases table for all environments? BTW if this is correct the all already released drivers are broken.

Copy link
Contributor

Choose a reason for hiding this comment

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

But we are here checking if information_schema.catalogs table exists. If it does, we continue to use it. If not, we choose to use information_schema.table, which I believe is invalid and it should be information_schema.databases. Am I missing something?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You are right; I've fixed a bug. Please review again.

Copy link

sonarcloud bot commented Jun 19, 2024

@alexradzin alexradzin merged commit 21e5f3c into master Jun 19, 2024
6 checks passed
@alexradzin alexradzin deleted the FIR-33601-catalogs branch June 19, 2024 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants