-
Notifications
You must be signed in to change notification settings - Fork 31
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
Should the SQL Storage be executing db.create_all()? #25
Comments
@ashcrow Another thing to keep in mind is that people use Here you will see that While using migrations, I was having trouble with |
Another suggestion, is to remove connection string argument, and instead allow We shouldn't create |
I was starting to think along the same lines. What if the we make the db input assume that the user will manually take care of creating tables, etc.. . But if user only passes in the connection string we assume they want the automatic creation and ownership? Would that end up working for your use case (while still retaining some backwards compatibility)? Do it for me example # ...
# I want the Storage to handle all the internals for me
SS.set_up(conn_str="slite:///tmp/db.sqlite"):
# Done .. I want control example* # ...
# I want more control
SS.set_up(db=db)
# Do things here
db.create_all()
# Done |
@ashcrow If compatibility is very important to you then we can try along the lines of what you have. I have noticed that connection string alone is insufficient to create an engine (some dbs take extra args which have to passed into create_engine method). I am leaning towards breaking compatibility in favor of better design. We can supplement docs by adding compatibility notes. What do you think? |
Okay you convinced me :-)
|
Awesome! Will give you a PR. |
@gouthambs sounds good! |
Modified SQLStorage to take engine and metadata. Fixes #25
From #22 (comment) by @gouthambs
My initial thought is it does make sense to execute
db.create_all()
if the tables to not already exist. If they do exist the plugin should step back and let the admin/programmer do what needs to be done.Right now if a user passes in a
db
instance they could easily executedb.create_all()
when they are ready. However, if they are usingconn_str
method of setting up they wouldn't have access to do so.However, I'm open to changing it as long as we can do it in a way that doesn't force the SQL Storage to be somewhat special. We could add
meta
as a public variable which could be used.@gouthambs Thoughts?
The text was updated successfully, but these errors were encountered: