Skip to content

Instantly share code, notes, and snippets.

@subpath
Created July 13, 2018 07:04
Show Gist options
  • Save subpath/21d51f985cb079252544b880caf2adfa to your computer and use it in GitHub Desktop.
Save subpath/21d51f985cb079252544b880caf2adfa to your computer and use it in GitHub Desktop.
PostgreSQL setup instruction

PostgreSQL setup instruction

Only for Ubuntu, because I use Ubuntu on

  1. Install postgreSQL:
sudo apt install postgresql postgresql-contrib
  1. Run postgreSQL:
sudo su - postgres

psql
  1. Create user and database:
CREATE USER user_name WITH PASSWORD "pass";
ALTER USER user_name WITH SUPERUSER;
CREATE DATABASE my_db;
  1. Create table for Twitter data:
CREATE TABLE twitter_sentiment_data(
    id UUID PRIMARY KEY NOT NULL,
    search_query text,
    twitter_id text,
    tweet_original text,
    tweet_translated text,
    lang text,
    created_at timestamp,
    geo text,
    reply_count integer,
    retweet_count integer,
    likes_count integer,
    user_id text,
    user_name text,
    user_location text,
    user_description text,
    user_verified boolean,
    user_followers_count integer,
    user_friends_count integer,

    polarity float,
    subjectivity float
);
  1. If you postgreSQL is on remote server, configure as followed: https://blog.bigbinary.com/2016/01/23/configure-postgresql-to-allow-remote-connection.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment