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

[Improvement] Optimize load database method in JdbcDatabaseOperations #6629

Open
yuqi1129 opened this issue Mar 6, 2025 · 1 comment · May be fixed by #6642
Open

[Improvement] Optimize load database method in JdbcDatabaseOperations #6629

yuqi1129 opened this issue Mar 6, 2025 · 1 comment · May be fixed by #6642
Labels
improvement Improvements on everything

Comments

@yuqi1129
Copy link
Contributor

yuqi1129 commented Mar 6, 2025

What would you like to be improved?

load method in JdbcDatabaseOperations will load all databases. if there are a lot of databases, it takes a lot of time.

  @Override
  public JdbcSchema load(String databaseName) throws NoSuchSchemaException {
    // We need to load the database as needed NOT load them all. 
    List<String> allDatabases = listDatabases();
    String dbName =
        allDatabases.stream()
            .filter(db -> db.equals(databaseName))
            .findFirst()
            .orElseThrow(
                () -> new NoSuchSchemaException("Database %s could not be found", databaseName));

    return JdbcSchema.builder()
        .withName(dbName)
        .withProperties(ImmutableMap.of())
        .withAuditInfo(AuditInfo.EMPTY)
        .build();
  }

How should we improve?

No response

@yuqi1129 yuqi1129 added the improvement Improvements on everything label Mar 6, 2025
@sunxiaojian
Copy link
Contributor

@yuqi1129 please assign it to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvements on everything
Projects
None yet
2 participants