Skip to content

Commit

Permalink
Remove BenK EventsProcessor code, this is no longer used.
Browse files Browse the repository at this point in the history
Confirmed by @peteradrichem

This code was no longer working since the benk-dataset was removed
in: Amsterdam/amsterdam-schema#1032
This also removes the `schema import events` CLI command.
  • Loading branch information
vdboor committed Jul 8, 2024
1 parent 142d754 commit c49fab8
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 2,324 deletions.
29 changes: 2 additions & 27 deletions src/schematools/cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Cli tools."""

from __future__ import annotations

import io
Expand Down Expand Up @@ -31,7 +32,6 @@
ckan,
validation,
)
from schematools.events.full import EventsProcessor
from schematools.exceptions import (
DatasetNotFound,
IncompatibleMetaschema,
Expand Down Expand Up @@ -865,32 +865,6 @@ def import_geojson(
importer.load_file(geojson_path, batch_size=batch_size, truncate=truncate_table)


@import_.command("events")
@option_db_url
@option_schema_url
@argument_dataset_id
@click.option("--additional-schemas", "-a", multiple=True)
@click.argument("events_path")
@click.option("-t", "--truncate-table", default=False, is_flag=True)
def import_events(
db_url: str,
schema_url: str,
dataset_id: str,
additional_schemas: str,
events_path: str,
truncate_table: bool,
) -> None:
"""Import an events file into a table."""
engine = _get_engine(db_url)
dataset_schemas = [_get_dataset_schema(dataset_id, schema_url)]
for schema in additional_schemas:
dataset_schemas.append(_get_dataset_schema(schema, schema_url))
# Create connection, do not start a transaction.
with engine.connect() as connection:
importer = EventsProcessor(dataset_schemas, connection, truncate=truncate_table)
importer.load_events_from_file(events_path)


def _get_dataset_schema(
dataset_id: str, schema_url: str, prefetch_related: bool = False
) -> DatasetSchema:
Expand Down Expand Up @@ -960,6 +934,7 @@ def create_tables(db_url: str, schema_url: str, dataset_id: str) -> None:
is_versioned_dataset=importer.is_versioned_dataset,
)


@create.command("sql")
@click.option("--versioned/--no-versioned", default=True)
@option_db_url
Expand Down
5 changes: 0 additions & 5 deletions src/schematools/events/__init__.py

This file was deleted.

Loading

0 comments on commit c49fab8

Please sign in to comment.