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

selectFromDB:: hook to real data #2

Closed
famulare opened this issue Apr 3, 2019 · 8 comments
Closed

selectFromDB:: hook to real data #2

famulare opened this issue Apr 3, 2019 · 8 comments
Assignees
Labels
enhancement New feature or request

Comments

@famulare
Copy link
Member

famulare commented Apr 3, 2019

Once we have the handoff credentials set up, we need to add SQL hooks to the real database. We should also maintain the ability to connect to the simulated data for prototyping and model validation.

@famulare famulare added the enhancement New feature or request label Apr 3, 2019
@famulare famulare self-assigned this Apr 15, 2019
@famulare
Copy link
Member Author

Hi @grhuynh . Cool getting the hook to the real database in! https://github.com/seattleflu/incidence-mapper/tree/master/dbViewRSQL

I think we should add this to dbViewR::selectFromDB and make the default the real database, and add a flag to pull from the simulated data instead.

If you swap the few lines with allData and the first db definition in dbViewR::selectData (

rawData <- RCurl::getURL("https://raw.githubusercontent.com/seattleflu/simulated-data/master/simulatedSubjectDatabase.csv")
), it might "just work."

I think it'll probably take me 30 minutes to do it, so I assigned this ticket to myself. But if you want to have a go, take it!

@famulare
Copy link
Member Author

How do credentials work? Is it interactive, or do I have to point it to my local credentials?

db <- dbConnect(RPostgres::Postgres(), host="production.db.seattleflu.org", dbname = 'production', user='', password='')

@grhuynh
Copy link
Collaborator

grhuynh commented Apr 15, 2019

I haven't figured out how to get it R working with local credentials, even though command line access works with local credentials - for the above literally just paste in the username and pw that Thomas sent with keybase/GPG (might have sent it to Clinton if you didn't get them yet. I think I saw that go by on Slack.

@famulare
Copy link
Member Author

Okay. The cheap solution will probably be to point to a personal credential file that doesn't get checked in, but we'll see what @devclinton suggests. I'll be chipping away very slowly at some stuff over the next few days between symposium talks.

@famulare
Copy link
Member Author

started a branch to work through db connection without breaking master: https://github.com/seattleflu/incidence-mapper/tree/connect-to-real-data

@tsibley
Copy link
Member

tsibley commented Apr 17, 2019

It should definitely be possible to use a pgpass and pg_service.conf file to make the database connection line simpler and not tied to a particular set of credentials or connection details.

@grhuynh
Copy link
Collaborator

grhuynh commented Apr 18, 2019

@famulare and @tsibley got connection to pgpass and pg_service working, you just have to type in the directory to find those files at the top of dbViewR_SQL.R. Assuming you can connect to the database at the command line, then this should work!

@famulare
Copy link
Member Author

works on connect-to-real-data branch as of 12949d1. See #40 and #31 if you're having issues connecting from your local docker container with your database credentials from @tsibley .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants