MCPcopy Create free account
hub / github.com/bytebase/bytebase / descTbl

Method descTbl

backend/plugin/db/databricks/dump.go:169–194  ·  view source on GitHub ↗
(ctx context.Context, tblName string)

Source from the content-addressed store, hash-verified

167}
168
169func (d *Driver) descTbl(ctx context.Context, tblName string) (*tableAdditionalInfo, error) {
170 tblAddInfo := &tableAdditionalInfo{
171 tblProps: make(map[string]string),
172 }
173 rows, _, err := d.execStatementSync(ctx, fmt.Sprintf("DESC FORMATTED %s", tblName), 0)
174 if err != nil {
175 return nil, err
176 }
177
178 for _, row := range rows {
179 infoKey := row[0]
180 infoVal := row[1]
181 if infoKey == "Table Properties" {
182 pattern := regexp.MustCompile("([a-zA-Z0-9-.]*)=([a-zA-Z0-9-.]*)")
183 matches := pattern.FindAllStringSubmatch(infoVal, -1)
184 if matches == nil {
185 continue
186 }
187 for _, match := range matches {
188 tblAddInfo.tblProps[match[1]] = match[2]
189 }
190 }
191 }
192
193 return tblAddInfo, nil
194}
195
196func formatTblProperties(tblAddInfo *tableAdditionalInfo) (string, error) {
197 if tblAddInfo == nil || tblAddInfo.tblProps == nil {

Callers 1

DumpMethod · 0.95

Implementers 15

MockDriverbackend/plugin/advisor/utils_for_tests
Driverbackend/plugin/db/bigquery/bigquery.go
Driverbackend/plugin/db/mongodb/mongodb.go
Driverbackend/plugin/db/trino/trino.go
Driverbackend/plugin/db/redshift/redshift.go
Driverbackend/plugin/db/oracle/oracle.go
Driverbackend/plugin/db/dynamodb/dynamodb.go
Driverbackend/plugin/db/cosmosdb/cosmosdb.go
Driverbackend/plugin/db/spanner/spanner.go
Driverbackend/plugin/db/mssql/mssql.go
Driverbackend/plugin/db/mysql/mysql.go
Driverbackend/plugin/db/pg/pg.go

Calls 1

execStatementSyncMethod · 0.95

Tested by

no test coverage detected