Created
February 24, 2024 10:37
-
-
Save bsnacks000/8946ccd2ad56764686ef7eb4b43628ac to your computer and use it in GitHub Desktop.
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
| #!/bin/bash | |
| # Simple pattern for exporting a query from postgres into jsonl using psql \copy command | |
| pg_url=$POSTGRES_URL | |
| fpath=$FPATH | |
| psql $pg_url > $fpath << EOF | |
| \copy(select to_jsonb(r) as jl from (select * from my_table) r ) to stdout; | |
| EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment