Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat: enable Oracle data anonymization (#6746)

rebelice44827570ca3c
diff --git a/backend/api/v1/sql_service.go b/backend/api/v1/sql_service.go
index 95a61939b4..ecf9537d32 100644
--- a/backend/api/v1/sql_service.go
+++ b/backend/api/v1/sql_service.go
@@ -482,6 +482,11 @@ func (s *SQLService) preExport(ctx context.Context, request *v1pb.ExportRequest)
if err != nil {
return nil, nil, nil, nil, status.Errorf(codes.Internal, "Failed to get sensitive schema info: %s", request.Statement)
}
+ case db.Oracle:
+ sensitiveSchemaInfo, err = s.getSensitiveSchemaInfo(ctx, instance, []string{request.ConnectionDatabase}, request.ConnectionDatabase)
+ if err != nil {
+ return nil, nil, nil, nil, status.Errorf(codes.Internal, "Failed to get sensitive schema info: %s", request.Statement)
+ }
}
// Create export activity.
@@ -715,6 +720,11 @@ func (s *SQLService) preQuery(ctx context.Context, request *v1pb.QueryRequest) (
if err != nil {
return nil, nil, advisor.Success, nil, nil, nil, status.Errorf(codes.Internal, "Failed to get sensitive schema info: %s", request.Statement)
}
+ case db.Oracle:
+ sensitiveSchemaInfo, err = s.getSensitiveSchemaInfo(ctx, instance, []string{request.ConnectionDatabase}, request.ConnectionDatabase)
+ if err != nil {
+ return nil, nil, advisor.Success, nil, nil, nil, status.Errorf(codes.Internal, "Failed to get sensitive schema info: %s", request.Statement)
+ }
}
}
@@ -822,6 +832,38 @@ func (s *SQLService) getSensitiveSchemaInfo(ctx context.Context, instance *store
return nil, echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to find table list for database %q", databaseName))
}
+ if instance.Engine == db.Oracle {
+ for _, schema := range dbSchema.Metadata.Schemas {
+ databaseSchema := db.DatabaseSchema{
+ Name: schema.Name,
+ TableList: []db.TableSchema{},
+ }
+ for _, table := range schema.Tables {
+ tableSchema := db.TableSchema{
+ Name: table.Name,
+ ColumnList: []db.ColumnInfo{},
+ }
+ for _, column := range table.Columns {
+ _, sensitive := columnMap[api.SensitiveData{
+ Schema: schema.Name,
+ Table: table.Name,
+ Column: column.Name,
+ }]
+ tableSchema.ColumnList = append(tableSchema.ColumnList, db.ColumnInfo{
+ Name: column.Name,
+ Sensitive: sensitive,
+ })
+ }
+ databaseSchema.TableList = append(databaseSchema.TableList, tableSchema)
+ }
+ if len(databaseSchema.TableList) > 0 {
+ isEmpty = false
+ }
+ result.DatabaseList = append(result.DatabaseList, databaseSchema)
+ }
+ continue
+ }
+
databaseSchema := db.DatabaseSchema{
Name: databaseName,
TableList: []db.TableSchema{},
diff --git a/frontend/src/components/ColumnTable.vue b/frontend/src/components/ColumnTable.vue
index 8bc983934c..4ffc846d66 100644
--- a/frontend/src/components/ColumnTable.vue
+++ b/frontend/src/components/ColumnTable.vue
@@ -127,7 +127,8 @@ const showSensitiveColumn = computed(() => {
hasSensitiveDataFeature.value &&
(engine.value === Engine.MYSQL ||
engine.value === Engine.TIDB ||
- engine.value === Engine.POSTGRES)
+ engine.value === Engine.POSTGRES ||
+ engine.value === Engine.ORACLE)
);
});