Skip to content

Commit

Permalink
Expose option to skip strict mode in table creation
Browse files Browse the repository at this point in the history
  • Loading branch information
betsybookwyrm committed Aug 3, 2023
1 parent 4cefdfa commit 924eda9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/tidy_tweet/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@
@click.command()
@click.argument("database", type=click.Path(path_type=Path), required=True)
@click.argument("json_files", type=click.Path(exists=True), nargs=-1)
def tidy_twarc_jsons(database: Path, json_files: Collection[Union[str, PathLike]]):
@click.option(
"--strict/--no_strict",
default=True,
help="Should the SQLite tables be created in strict mode (defaults to yes)? "
"Irrelevant if adding files to an existing database.",
)
def tidy_twarc_jsons(
database: Path, json_files: Collection[Union[str, PathLike]], strict
):
"""
Tidies Twitter json collected with Twarc into relational tables.
Expand Down Expand Up @@ -55,7 +63,7 @@ def tidy_twarc_jsons(database: Path, json_files: Collection[Union[str, PathLike]
else:
# If database doesn't exist, initialise it
click.echo("Creating new tidy tweet database: " + str(database))
db.initialise_sqlite(database)
db.initialise_sqlite(database, strict_mode=strict)

# Load files into database
num_files = len(json_files)
Expand Down

0 comments on commit 924eda9

Please sign in to comment.