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

Add easy func to re-run dbc_init to set new tables as variables #1

Open
machow opened this issue Jan 1, 2021 · 2 comments
Open

Add easy func to re-run dbc_init to set new tables as variables #1

machow opened this issue Jan 1, 2021 · 2 comments

Comments

@machow
Copy link

machow commented Jan 1, 2021

If I run dbc_init(..., "my_db"), it sets variables for tables like my_db_public_some_table.

This happens for all tables that exist when I run dbc_init and is super handy!
However, if I add tables after running init, then they won't show up until I re-run the dbc_init(...) command.

WDYT of adding a helper like my_db_init()? That way, users have this handy workflow

dbc_init(some_conn, "my_db")

# Create a table ----

# using execute
my_db_execute(...)

# or using dplyr
copy_to(dbc_init_src(), mtcars, "mtcars")

# Re-init and view new table ----
my_db_init()

# now, my_db_<TAB> gives my_db_public_mtcars

In practice, re-running dbc_init(my_db_src()$con, "my_db") isn't too bad, but I seem to run it a lot to keep things "in sync"!

@dgrtwo
Copy link
Collaborator

dgrtwo commented Jan 1, 2021

This is a great idea!

How do you feel about calling it <my_db>_update instead of <my_db>_init?

@machow
Copy link
Author

machow commented Jan 1, 2021

using _update makes sense to me!

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

No branches or pull requests

2 participants