Skip to content

Instantly share code, notes, and snippets.

@Kamparia
Created December 15, 2020 07:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kamparia/45459b1639ae381170e36f93ee598990 to your computer and use it in GitHub Desktop.
Save Kamparia/45459b1639ae381170e36f93ee598990 to your computer and use it in GitHub Desktop.
Task One: Create Postgres Table (if none exists).
# Task One: Create Postgres Table (if none exists).
task_one = PostgresOperator(
task_id = 'create_table',
sql = '''CREATE TABLE IF NOT EXISTS public.earthquake_events (
event_id VARCHAR(50) NOT NULL,
event_name VARCHAR(160) NOT NULL,
magnitude DECIMAL NOT NULL,
longitude DECIMAL NOT NULL,
latitude DECIMAL NOT NULL,
date DATE NOT NULL);''',
postgres_conn_id = 'postgres_default',
database = Variable.get("USGS_DB_NAME")
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment