Skip to content

Commit

Permalink
powerbi: Remove newline escapes within SQL statements
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Sep 19, 2024
1 parent 3e677bf commit 83d7661
Showing 1 changed file with 5 additions and 34 deletions.
39 changes: 5 additions & 34 deletions powerbi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,58 +64,29 @@ codelist: createdb createuser
curl -sSL https://raw.githubusercontent.com/open-contracting/deploy/main/salt/kingfisher/collect/files/data/codelist.csv | \
psql $(DATABASE_NAME) -U $(DATABASE_USER) -h $(DATABASE_HOST) -v ON_ERROR_STOP=1 \
-c 'DROP TABLE IF EXISTS codelist' \
-c 'CREATE TABLE codelist ( \
id serial PRIMARY KEY, \
codelist text, \
code text, \
code_es text, \
UNIQUE (codelist, code) \
)' \
-c 'CREATE TABLE codelist (id serial PRIMARY KEY, codelist text, code text, code_es text, UNIQUE (codelist, code))' \
-c '\copy codelist (codelist, code, code_es) from stdin csv header'

.PHONY: cpc
cpc: createdb createuser
curl -sSL https://raw.githubusercontent.com/open-contracting/deploy/main/salt/kingfisher/collect/files/data/cpc.csv | \
psql $(DATABASE_NAME) -U $(DATABASE_USER) -h $(DATABASE_HOST) -v ON_ERROR_STOP=1 \
-c 'DROP TABLE IF EXISTS cpc' \
-c 'CREATE TABLE cpc ( \
id serial PRIMARY KEY, \
code text UNIQUE, \
description text, \
description_es text \
)' \
-c 'CREATE TABLE cpc (id serial PRIMARY KEY, code text UNIQUE, description text, description_es text)' \
-c '\copy cpc (code, description, description_es) from stdin csv header'

.PHONY: indicator
indicator: createdb createuser
curl -sSL https://raw.githubusercontent.com/open-contracting/deploy/main/salt/kingfisher/collect/files/data/indicator.csv | \
psql $(DATABASE_NAME) -U $(DATABASE_USER) -h $(DATABASE_HOST) -v ON_ERROR_STOP=1 \
-c 'DROP TABLE IF EXISTS indicator' \
-c 'CREATE TABLE indicator ( \
id serial PRIMARY KEY, \
code text UNIQUE, \
category text, \
title text, \
description text, \
category_es text, \
title_es text, \
description_es text \
)' \
-c 'CREATE TABLE indicator (id serial PRIMARY KEY, code text UNIQUE, category text, title text, description text, category_es text, title_es text, description_es text)' \
-c '\copy indicator (code, category, title, description, category_es, title_es, description_es) from stdin csv header'

.PHONY: ecuador_sercop_bulk_result
ecuador_sercop_bulk_result: createdb createuser
psql $(DATABASE_NAME) -U $(DATABASE_USER) -h $(DATABASE_HOST) -c 'CREATE TABLE IF NOT EXISTS ecuador_sercop_bulk_result ( \
id serial PRIMARY KEY, \
ocid text, \
subject text, \
code text, \
result numeric, \
buyer_id text, \
procuring_entity_id text, \
tenderer_id text, \
created_at timestamp without time zone \
)'
psql $(DATABASE_NAME) -U $(DATABASE_USER) -h $(DATABASE_HOST) \
-c 'CREATE TABLE IF NOT EXISTS ecuador_sercop_bulk_result (id serial PRIMARY KEY, ocid text, subject text, code text, result numeric, buyer_id text, procuring_entity_id text, tenderer_id text, created_at timestamp without time zone)'

.PHONY: database
database: codelist cpc indicator ecuador_sercop_bulk_result
Expand Down

0 comments on commit 83d7661

Please sign in to comment.