| 16 | var registerOnce = gosync.OnceValue(types.RegisterAllExtensions) |
| 17 | |
| 18 | func getTables(ctx context.Context, sourcePbClient pluginPb.PluginClient, req *pluginPb.GetTables_Request) (schema.Tables, error) { |
| 19 | getTablesResp, err := sourcePbClient.GetTables(ctx, req) |
| 20 | if err != nil { |
| 21 | return nil, fmt.Errorf("failed to get tables: %w", err) |
| 22 | } |
| 23 | schemas, err := pluginPb.NewSchemasFromBytes(getTablesResp.Tables) |
| 24 | if err != nil { |
| 25 | return nil, fmt.Errorf("failed to parse schemas: %w", err) |
| 26 | } |
| 27 | tables, err := schema.NewTablesFromArrowSchemas(schemas) |
| 28 | if err != nil { |
| 29 | return nil, fmt.Errorf("failed to convert schemas to tables: %w", err) |
| 30 | } |
| 31 | |
| 32 | return tables, nil |
| 33 | } |
| 34 | |
| 35 | func tablesV3(ctx context.Context, sourceClient *managedplugin.Client, sourceSpec *specs.Source, path, format, filter string) error { |
| 36 | err := registerOnce() |