Skip to content

Commit

Permalink
code cleanup and remove jdbc_string.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
csalvato committed Mar 7, 2016
1 parent 5fd9212 commit f0f8f93
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
.Rproj.user
.RData
.Rhistory
jdbc_string.txt
10 changes: 5 additions & 5 deletions adwords.r
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ as.week <- function(date_vector){
floor_date(date_vector, "week") + days(1)
}

query_from_file <- function(file_name){
string_from_file <- function(file_name){
GetoptLong::qq(scan(file_name, character()))
}

Expand All @@ -46,11 +46,11 @@ end_date = toString(Sys.Date())
# Retrieve revenue data
pgsql <- JDBC("org.postgresql.Driver", "../database_drivers/postgresql-9.2-1004.jdbc4.jar", "`")
#heroku_db <- dbConnect(pgsql, "jdbc:postgresql://ec2-54-221-203-136.compute-1.amazonaws.com:5502/dfh97e63ls7ag8?user=u1gg5j81iss15&password=p1g2km19noav948l6q7net768vu&ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory")
datawarehouse_db <- dbConnect(pgsql, "jdbc:postgresql://127.0.0.1:5438/mps_oltp?user=oltp_reader&password=0Ltpr33@donly")
datawarehouse_db <- dbConnect(pgsql, string_from_file("jdbc_string.txt"))

transactions_query <- query_from_file("transactions_query.sql")
adwords_campaigns_query <- query_from_file("adwords_campaigns_query.sql")
influencer_metrics_query <- query_from_file("influencer_metrics_query.sql")
transactions_query <- string_from_file("transactions_query.sql")
adwords_campaigns_query <- string_from_file("adwords_campaigns_query.sql")
influencer_metrics_query <- string_from_file("influencer_metrics_query.sql")

db_influencer_metrics <- dbGetQuery(datawarehouse_db, influencer_metrics_query)
db_adwords_campaigns <- dbGetQuery(datawarehouse_db, adwords_campaigns_query)
Expand Down

0 comments on commit f0f8f93

Please sign in to comment.