Created
October 23, 2024 18:45
-
-
Save tomfa/78195e0e069ec1ac37a2bb22a6c11693 to your computer and use it in GitHub Desktop.
PSQL to JSON: creating data for tests based on database data
This file contains 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
select json_agg(row_to_json(t)) from (select * from "my_table" LIMIT 1) as t; | |
-- This ⬆️ will return a json of the results, which you could use for test data/mock data, you name it. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment