Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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