Created
March 17, 2021 10:33
-
-
Save xoelop/286d4599b12941142d7d0630ffbf4371 to your computer and use it in GitHub Desktop.
Creates a postgres db locally, runs postgres server and inserts events data
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
DROP TABLE IF EXISTS events; | |
CREATE TABLE events | |
( | |
date timestamp, | |
product_id text, | |
user_id bigint, | |
event text, | |
extra_data json | |
); | |
\copy events from '/Users/xoel/CODE/Tinybird/events_generator/datasets/events_10K.csv' CSV HEADER; |
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
echo removing postgres db directory | |
rm -rf postgresdb | |
echo creating postgres data directory | |
initdb postgresdb | |
echo run postgres server | |
postgres -D postgresdb |
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
echo create user locally | |
createdb -h localhost | |
echo inserting data into postgres | |
psql -h localhost -p 5432 -f window-funcs/create_events_table_postgres.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment