tidy-finance / website

This repository hosts the source code for the website tidy-finance.org
https://tidy-finance.org
Other
82 stars 47 forks source link

Clarify creation and replacement of environment variables for WRDS connection #112

Closed christophscheuch closed 3 months ago

christophscheuch commented 4 months ago

It is neither straight-forward how to create, nor how to replace environment variables for the WRDS connection.

We write: "To establish a connection, you use the function create_engine() with a connection string. Note that you need to replace the WRDS_USER and WRDS_PASSWORD arguments with your own credentials. We defined environment variables for the purpose of this book because we obviously do not want (and are not allowed) to share our credentials with the rest of the world (these environment variables are stored in the .env file of our project directory, loaded with load_dotenv(), and then called with the os.getenv() function)."

Issues:

Proposal:

voigtstefan commented 4 months ago

An easier alternative for a user who only wants to run code is to replace the entire call to os.getenv("...") with her personal credentials. I don't necessarily think that every use case justifies to populate the .env file.

christophscheuch commented 4 months ago

My intention is to include both a clear reformulation what needs to be replaced and an example .env to Getting Started and a reference to it in WRDS chapter. If people want to share their code via GitHub etc then they should know how to work with .env files.

patrick-weiss commented 4 months ago

How about prompting the user for the required input?

rstudioapi::askForPassword("WRDS username") rstudioapi::askForPassword("WRDS password")

christophscheuch commented 4 months ago

We decided to use the prompt approach only in r-tidyfinance and go with the changes in my previous post 🙏