mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-30 08:20:33 +00:00
fix(trino): support schema-aware table browsing and inserts
This commit is contained in:
@@ -812,7 +812,9 @@ const tableUsesSyntheticRowId = computed(() =>
|
||||
usesSyntheticRowIdKey(props.databaseType, props.tableMeta?.primaryKeys ?? []),
|
||||
);
|
||||
const hiveTableTransactional = ref<boolean | undefined>(undefined);
|
||||
const canEditExistingRows = computed(() => canEditExistingTableRows(props.databaseType, hiveTableTransactional.value));
|
||||
const canEditExistingRows = computed(() =>
|
||||
canEditExistingTableRows(props.databaseType, hiveTableTransactional.value, props.tableMeta?.primaryKeys ?? []),
|
||||
);
|
||||
watch(
|
||||
() => [props.databaseType, props.connectionId, props.database, props.tableMeta?.schema, props.tableMeta?.tableName],
|
||||
async () => {
|
||||
@@ -2033,7 +2035,7 @@ defineExpose({
|
||||
{{ t("grid.refresh") }}
|
||||
</Button>
|
||||
<Button
|
||||
v-if="useTransaction && editable && (tableMeta || customSave)"
|
||||
v-if="editable && (tableMeta || customSave)"
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
class="h-5 text-xs px-1.5 shrink-0"
|
||||
|
||||
@@ -12,6 +12,7 @@ export const SCHEMA_AWARE_TYPES = new Set<DatabaseType>([
|
||||
"jdbc",
|
||||
"h2",
|
||||
"snowflake",
|
||||
"trino",
|
||||
"db2",
|
||||
"informix",
|
||||
]);
|
||||
@@ -109,7 +110,14 @@ export const SINGLE_DATABASE_TYPES = new Set<DatabaseType>(["oracle", "dameng"])
|
||||
|
||||
export const FETCH_FIRST_TYPES = new Set<DatabaseType>(["oracle", "dameng"]);
|
||||
|
||||
export const TREE_SCHEMA_TYPES = new Set<DatabaseType>(["postgres", "redshift", "sqlserver", "gaussdb", "jdbc"]);
|
||||
export const TREE_SCHEMA_TYPES = new Set<DatabaseType>([
|
||||
"postgres",
|
||||
"redshift",
|
||||
"sqlserver",
|
||||
"gaussdb",
|
||||
"jdbc",
|
||||
"trino",
|
||||
]);
|
||||
|
||||
export const PG_LIKE_STRUCTURE_TYPES = new Set<DatabaseType>(["postgres", "redshift", "gaussdb"]);
|
||||
|
||||
|
||||
@@ -12,18 +12,21 @@ export function editablePrimaryKeys(databaseType: DatabaseType | undefined, colu
|
||||
|
||||
export function isTableDataEditable(databaseType: DatabaseType | undefined, primaryKeys: string[]): boolean {
|
||||
if (databaseType === "hive") return true;
|
||||
if (databaseType === "trino") return true;
|
||||
return primaryKeys.length > 0;
|
||||
}
|
||||
|
||||
export function supportsDataGridTransaction(databaseType: DatabaseType | undefined): boolean {
|
||||
return databaseType !== "hive";
|
||||
return databaseType !== "hive" && databaseType !== "trino";
|
||||
}
|
||||
|
||||
export function canEditExistingTableRows(
|
||||
databaseType: DatabaseType | undefined,
|
||||
hiveTableTransactional?: boolean,
|
||||
primaryKeys: string[] = [],
|
||||
): boolean {
|
||||
if (databaseType === "hive") return hiveTableTransactional === true;
|
||||
if (databaseType === "trino") return primaryKeys.length > 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user