def ls5_dataset_w_children(index, example_ls5_dataset_path, indexed_ls5_scene_products): # type: (Driver, Path, DatasetType) -> Dataset # TODO: We need a higher-level API for indexing paths, rather than reaching inside the cli script datasets = list( dataset_script.load_datasets( [example_ls5_dataset_path], dataset_script.load_rules_from_types(index))) assert len(datasets) == 1 d = index.datasets.add(datasets[0]) return index.datasets.get(d.id, include_sources=True)
def migrate(test_db, prod_db, products, expressions): """ Migrate datasets from source database to target database. Supports query expressions like ``datacube``. Additionally, multiple products may be specified with multiple ``--product`` options. """ # connect to the source database prod_index = index_connect(prod_db, application_name='test-env') uris = collect_uris(prod_index, products, expressions) rules = load_rules_from_types(prod_index) # connect to the target database test_index = index_connect(test_db, application_name='test-env') index_uris(test_index, list(uris), rules)
def _get_rules(index): return dataset_script.load_rules_from_types(index)