Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1043 add map_index_template, fix name->item bug from #1035 #1072

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions dags/gcc_layers_pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ def get_layers(name):
tables = Variable.get('gcc_layers', deserialize_json=True)
return tables[name]

@task() #add after 2.9.3 upgrade: map_index_template="{{ table_name }}"
@task(map_index_template="{{ table_name }}")
def pull_layer(layer, conn_id):
#name mapped task (implement after 2.9.3 upgrade)
#context = get_current_context()
#context["table_name"] = layer[0]
#name mapped task
context = get_current_context()
context["table_name"] = layer[0]
#get db connection
conn = PostgresHook(conn_id).get_conn()

Expand Down Expand Up @@ -92,7 +92,7 @@ def pull_layer(layer, conn_id):
create_gcc_puller_dag(
dag_id=dag_name,
default_args=DEFAULT_ARGS,
name=dag_name,
name=item,
conn_id=DAGS[item]['conn'],
)
)
2 changes: 1 addition & 1 deletion gis/gccview/gcc_puller_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def create_partitioned_table(output_table, return_json, schema_name, con):
schema_parent_table = sql.Identifier(schema_name, output_table))
cur.execute(create_sql, (today_string, ))

index_sql = sql.SQL("CREATE INDEX {idx_name} ON {schema_child_table} USING gist (geom)").format(idx_name=sql.Identifier(index_name),
index_sql = sql.SQL("CREATE INDEX IF NOT EXISTS {idx_name} ON {schema_child_table} USING gist (geom)").format(idx_name=sql.Identifier(index_name),
schema_child_table=sql.Identifier(schema_name, output_table_with_date))
cur.execute(index_sql)

Expand Down