fix(compare): let oracle pick schemas in data compare
This commit is contained in:
1 parent
5f9ba51769
commit
23f0b1255b
4 files changed
+148
-26
No files matched your search
@@ -4,10 +4,12 @@ import { filterDatabaseNamesForConnection, filterSchemaNamesForConnection } from
|
||||
import { isDorisFamilyCatalogCapable, supportsQueryTargetDatabaseListing } from "@/lib/database/databaseFeatureSupport";
|
||||
import { usesTreeSchemaMode } from "@/lib/database/databaseCapabilities";
|
||||
import { isInternalDorisCatalog } from "@/lib/database/databaseFeatureSupport";
|
||||
import { connectionUsesConnectionRootSchemaMode } from "@/lib/database/jdbcDialect";
|
||||
import type { CatalogInfo, ConnectionConfig } from "@/types/database";
|
||||
import * as api from "@/lib/backend/api";
|
||||
|
||||
type NamespaceOptionsConnection = Pick<ConnectionConfig, "database" | "db_type" | "driver_profile" | "visible_databases" | "visible_schemas"> & Partial<Pick<ConnectionConfig, "database_info">>;
|
||||
type NamespaceOptionsConnection = Pick<ConnectionConfig, "database" | "db_type" | "driver_profile" | "driver_label" | "connection_string" | "jdbc_driver_class" | "jdbc_driver_paths" | "visible_databases" | "visible_database_patterns" | "visible_schemas" | "username" | "show_system_schemas"> &
|
||||
Partial<Pick<ConnectionConfig, "database_info">>;
|
||||
export function catalogDatabaseOptionsKey(connectionId: string, catalog: string): string {
|
||||
return `${connectionId}:${catalog}`;
|
||||
}
|
||||
@@ -39,15 +41,16 @@ export function databaseOptionsForConnection(databaseNames: string[], connection
|
||||
return names;
|
||||
}
|
||||
|
||||
export function namespaceOptionsAreSchemas(connection: Pick<ConnectionConfig, "db_type"> | undefined): boolean {
|
||||
return connection?.db_type === "dameng";
|
||||
export function namespaceOptionsAreSchemas(connection: NamespaceOptionsConnection | undefined): boolean {
|
||||
return connectionUsesConnectionRootSchemaMode(connection);
|
||||
}
|
||||
|
||||
export async function fetchNamespaceOptionsForConnection(connectionId: string, connection: NamespaceOptionsConnection): Promise<string[]> {
|
||||
if (connection.db_type === "dameng") {
|
||||
if (namespaceOptionsAreSchemas(connection)) {
|
||||
const database = connection.database || "";
|
||||
// Dameng users and schemas are not interchangeable: independent schemas
|
||||
// appear in listSchemas but not in the user-backed listDatabases result.
|
||||
// Oracle, Dameng, and their inferred JDBC dialects expose schemas directly
|
||||
// below the connection; their catalog/database listing is not the namespace
|
||||
// picker used by schema-aware UI surfaces.
|
||||
const schemas = await api.listSchemas(connectionId, database, true);
|
||||
return filterSchemaNamesForConnection(schemas, connection, database);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user