|
15 | 15 | import click |
16 | 16 | from click import wrap_text |
17 | 17 |
|
18 | | -from splitgraph.cloud.models import AddExternalRepositoryRequest |
| 18 | +from splitgraph.cloud.models import AddExternalRepositoryRequest, IntrospectionMode |
19 | 19 | from splitgraph.cloud.project.models import Metadata, SplitgraphYAML |
20 | 20 | from splitgraph.commandline.common import ( |
21 | 21 | ImageType, |
@@ -613,9 +613,28 @@ def dump_c(remote, readme_dir, repositories_file, limit_repositories): |
613 | 613 | is_flag=True, |
614 | 614 | help="Only set up the metadata, not the external data source settings", |
615 | 615 | ) |
| 616 | +@click.option( |
| 617 | + "--introspection-mode", |
| 618 | + type=click.Choice(IntrospectionMode), |
| 619 | + default=IntrospectionMode.EMPTY, |
| 620 | + help="Whether to reintrospect tables. none: never reintrospect. all: reintrospect all tables. " |
| 621 | + "empty: only reintrospect tables with an empty schema.", |
| 622 | +) |
| 623 | +@click.option( |
| 624 | + "--ignore-introspection-errors", |
| 625 | + is_flag=True, |
| 626 | + help="If set, will ignore errors when introspecting tables.", |
| 627 | +) |
616 | 628 | @click.argument("limit_repositories", type=str, nargs=-1) |
617 | 629 | def load_c( |
618 | | - remote, readme_dir, skip_external, initial_private, repositories_file, limit_repositories |
| 630 | + remote, |
| 631 | + readme_dir, |
| 632 | + skip_external, |
| 633 | + initial_private, |
| 634 | + repositories_file, |
| 635 | + limit_repositories, |
| 636 | + introspection_mode, |
| 637 | + ignore_introspection_errors, |
619 | 638 | ): |
620 | 639 | """ |
621 | 640 | Load a Splitgraph catalog from a YAML file. |
@@ -666,7 +685,11 @@ def load_c( |
666 | 685 | initial_private=initial_private, |
667 | 686 | ) |
668 | 687 | external_repositories.append(external_repository) |
669 | | - rest_client.bulk_upsert_external(repositories=external_repositories) |
| 688 | + rest_client.bulk_upsert_external( |
| 689 | + repositories=external_repositories, |
| 690 | + introspection_mode=introspection_mode, |
| 691 | + raise_errors=not ignore_introspection_errors, |
| 692 | + ) |
670 | 693 | logging.info(f"Uploaded images for {pluralise('repository', len(external_repositories))}") |
671 | 694 |
|
672 | 695 | logging.info("Updating metadata...") |
|
0 commit comments