(schemaMap databricksSchemaMap)
| 212 | } |
| 213 | |
| 214 | func convertToStorepbSchemas(schemaMap databricksSchemaMap) []*storepb.SchemaMetadata { |
| 215 | schemas := []*storepb.SchemaMetadata{} |
| 216 | for schemaName, tableList := range schemaMap { |
| 217 | schemaMetadata := &storepb.SchemaMetadata{ |
| 218 | Name: schemaName, |
| 219 | } |
| 220 | |
| 221 | for _, table := range tableList { |
| 222 | switch table.typeName { |
| 223 | case catalog.TableTypeView: |
| 224 | schemaMetadata.Views = append(schemaMetadata.Views, table.view) |
| 225 | case catalog.TableTypeMaterializedView: |
| 226 | schemaMetadata.MaterializedViews = append(schemaMetadata.MaterializedViews, table.materialView) |
| 227 | case catalog.TableTypeExternal: |
| 228 | schemaMetadata.ExternalTables = append(schemaMetadata.ExternalTables, table.externalTable) |
| 229 | case catalog.TableTypeManaged: |
| 230 | schemaMetadata.Tables = append(schemaMetadata.Tables, table.table) |
| 231 | default: |
| 232 | // we do not sync streaming table. |
| 233 | } |
| 234 | } |
| 235 | schemas = append(schemas, schemaMetadata) |
| 236 | } |
| 237 | return schemas |
| 238 | } |
| 239 | |
| 240 | func getQualifiedTblName(catalogName, schemaName, tblName string) (string, error) { |
| 241 | if tblName == "" || schemaName == "" { |
no outgoing calls
no test coverage detected