-
Notifications
You must be signed in to change notification settings - Fork 16
delete_cascade Relationship functions #176
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
Comments
Other potential names for select_cascade: auto_requery, orm_cascade, etc. |
I think I have the delete cascade grabbing figured out for mysql/postgres (already had sqlite figured out) |
Sorry for the hiatus Here are my thoughts: I think overall it's a great idea and would add a lot of flexibility! |
Cool. I’ll work on this next |
Would it be simpler, instead of the property functions, if in the Form init, we instead had db_cascades = True? Then, if False, we wouldn’t get grab that info to begin with? |
Nvm, I’m overthinking this. I’ll have something for you to review by tonight or tomorrow afternoon |
When you get back and resolve the current pulls, I have the delete_cascade stuff working for Relationships and the SQLite sqldriver.
However, I’d like to know what to call the current cascade functions/variables to clarify things. I’m proposing the idea of a “select_cascade”
What is a select_cascade?
A select_cascade is what you originally called requery_table, then update_cascade. Right now ON UPDATE CASCADE is used as convenient meta data for pysimplesql, when a different parent is selected, it then requeries, using the new parent pk as a filter in the where clause. But what if a user has or wants to use ON UPDATE CASCADE in the true database sense, updating child records to match the parent? They currently wouldn’t be able to use
auto_map_relationships
. Or if they did, they'd need to go back and set some update_cascade's to FalseSo my current plan is to:
ON DELETE CASCADE
from database, store inRelationships
asdelete_cascade
update_cascade
as is, as a variable inRelationships
a) update_cascade_as_select = True by default
b) select_cascade_as_delete = ? Probably False, if you want 3.0 users to add delete cascade to their databases. But True would allow v2 compatibility.
Relationships
, and move all logic over to them:selector('parent', sg.Table, select_cascade=['child1','child2'])
. This would then be matched to the foreign key, in a separate auto function:Does that sound like a good plan? This allows v2 compatibility (with the _delete_cascade and select_cascade_as_delete), and gives users more flexibility about using ON UPDATE CASCADE for database reasons, or if they arent at liberty to modify an existing database.
Or let me know which parts sound good, which parts to keep out!
The text was updated successfully, but these errors were encountered: