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

Populate an existing database + schema? #42

Open
dwelch2344 opened this issue Mar 27, 2018 · 1 comment
Open

Populate an existing database + schema? #42

dwelch2344 opened this issue Mar 27, 2018 · 1 comment

Comments

@dwelch2344
Copy link

Hey there – is there any way we could run this against an existing database (with a flag or something is fine) and not get errors? We'd like to add this to our migrations in our dev environments, but we end up having to create a new database, then import it into the primary db.

We'd be happy to make adjustments in a PR if you want to outline the easiest / best way to do so. Thanks :)

@emirozer
Copy link
Owner

emirozer commented Mar 27, 2018

Hi @dwelch2344 !

Great to hear from users :) And it does make sense to be able to opt-out of db creation.
So these couple of days are going to be a bit hectic for me, thus I can take this on coming weekend to see what's the best way to do it..
My gut says that in every type of {database}_handler.py you will find a method that sort of does:

CREATE DATABASE {random_db_name here or the one that the user provides from --db}

Instead of directly going that route, fake2db checks if --db flag exists and then should check if a database already exists with that name. Then ofc instead of creation just setup the connection to the existing --db name

e.g: https://github.com/emirozer/fake2db/blob/master/fake2db/postgresql_handler.py#L46

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