feat: Export events to JSON Lines#451
Open
Anshumancanrock wants to merge 3 commits intocameri:mainfrom
Open
Conversation
0ad3e13 to
8ed6a89
Compare
Contributor
Author
|
Hi @cameri , Tested the exporter with the same events you sent :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds
npm run export [filename.jsonl], a streaming CLI command that writes all stored events to a.jsonlfile in NIP-01 format.pg-query-streamto read rows via cursor (no full dataset in RAM)id,pubkey,created_at,kind,tags,content,sigRelated Issue
Closes #405
Motivation and Context
Relay operators currently have no built-in way to export events in a portable format.
pg_dumpworks but is Postgres-specific and not useful for migrating between relay implementations or doing data analysis. This gives them a single command that outputs standard NIP-01 JSON Lines.How Has This Been Tested?
tsc --noEmit( compiles clean )eslint( no warnings )npm run exportagainst a local Postgres seeded with 3 million eventsnpm run export -- backup.jsonlScreenshots (if appropriate):
Types of changes
Checklist: