Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save xoelop/286d4599b12941142d7d0630ffbf4371 to your computer and use it in GitHub Desktop.
Save xoelop/286d4599b12941142d7d0630ffbf4371 to your computer and use it in GitHub Desktop.
Creates a postgres db locally, runs postgres server and inserts events data
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;
echo removing postgres db directory
rm -rf postgresdb
echo creating postgres data directory
initdb postgresdb
echo run postgres server
postgres -D postgresdb
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