Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use write_entity instead of deprecated write_object #34

Merged
merged 7 commits into from
Mar 28, 2024

Conversation

stchris
Copy link
Contributor

@stchris stchris commented Mar 5, 2024

Fixes the deprecation from #33 and seems to be much faster as well

--

Later edit: orjson.dumps returns bytes (while json.dumps returns str), so this required a change: all output files are opened in mode rb.

The write_stream and iterate_stream methods were moved to utils.py because, otherwise, importing ftmstore.cli for testing (in test_io.py) would have run into a circular import issue.

Added test_io.py to test both write_stream and iterate_stream.

@@ -59,7 +38,7 @@ def write(db, dataset, infile, origin):
@cli.command("iterate", help="Iterate entities")
@click.option("--db", metavar="URI", default=DATABASE_URI, show_default=True)
@click.option("-d", "--dataset", required=True)
@click.option("-o", "--outfile", type=click.File("w"), default="-")
@click.option("-o", "--outfile", type=click.File("w+b"), default="-")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

@stchris
Copy link
Contributor Author

stchris commented Mar 28, 2024

Thanks for seeing this through @catileptic !

@stchris stchris merged commit 09b6386 into main Mar 28, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants