Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
clickhouse: add databases to driver.
spinningbot0b4823659cf4
diff --git a/plugin/db/clickhouse/clickhouse.go b/plugin/db/clickhouse/clickhouse.goindex d73e5c0681..086498ba9a 100644--- a/plugin/db/clickhouse/clickhouse.go+++ b/plugin/db/clickhouse/clickhouse.go@@ -147,7 +147,35 @@ func (driver *Driver) SyncSchema(ctx context.Context) ([]*db.DBUser, []*db.DBSchreturn nil, nil, err}- return userList, nil, nil+ // Query db info+ where := fmt.Sprintf("name NOT IN (%s)", strings.Join(excludedDatabaseList, ", "))+ query := `+ SELECT+ name+ FROM system.databases+ WHERE ` + where+ rows, err := driver.db.QueryContext(ctx, query)+ if err != nil {+ return nil, nil, util.FormatErrorWithQuery(err, query)+ }+ defer rows.Close()++ schemaList := make([]*db.DBSchema, 0)+ for rows.Next() {+ var schema db.DBSchema+ if err := rows.Scan(+ &schema.Name,+ ); err != nil {+ return nil, nil, err+ }++ schemaList = append(schemaList, &schema)+ }+ if err := rows.Err(); err != nil {+ return nil, nil, err+ }++ return userList, schemaList, nil}func (driver *Driver) getUserList(ctx context.Context) ([]*db.DBUser, error) {diff --git a/plugin/db/driver.go b/plugin/db/driver.goindex 794a6124af..bafe073037 100644--- a/plugin/db/driver.go+++ b/plugin/db/driver.go@@ -81,12 +81,14 @@ type DBTable struct {}type DBSchema struct {- Name string+ Name string+ // CharacterSet is only applicable to MySQL/Postgres series.CharacterSet string- Collation string- UserList []DBUser- TableList []DBTable- ViewList []DBView+ // Collation is only applicable to MySQL/Postgres series.+ Collation string+ UserList []DBUser+ TableList []DBTable+ ViewList []DBView}var (