-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinsert_data.R
32 lines (22 loc) · 1.02 KB
/
insert_data.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
library(bigrquery)
library(DBI)
project_id <- "algeria-in-numbers"
dataset <- "automobiles"
con <- dbConnect(
bigrquery::bigquery(),
project = project_id,
dataset = dataset,
billing = project_id
)
sql_query <- glue_sql("INSERT INTO automobiles.ok_auto_raw (id, title, description, created_at, price,
price_review, price_type, exchange_type, price_unit, category_name, year,
engine, color, energy, papers_state, distance_travelled, brand, model, transmission,
car_options_en, car_options_fr, user_id, region_id, region_name, city_name,
insert_date, edition)
VALUES({id}, {title}, {description}, {created_at}, {price}, {price_preview},
{price_type}, {exchange_type}, {price_unit}, {category_name}, {year},
{engine}, {color}, {energy}, {papers_state}, {distance_travelled}, {brand},
{model}, {transmission}, {car_options_en}, {car_options_fr}, {user_id},
{region_id}, {region_name}, {city_name}, CURRENT_TIMESTAMP(), {edition})",
.con = con)
dbGetQuery(con, sql_query)