[sqlalchemy] Re: Update multiple rows in SQLite Databse

2020-09-07 Thread William Phillips
I have finally found a way to insert, update and delete ingredients from the recipe application. It is probably not the best way but it works. First since I had a button in the form to add an ingredient, I used a button to delete a selected ingredient. As for the Update and insert into an

[sqlalchemy] Re: Update multiple rows in SQLite Databse

2020-08-29 Thread William Phillips
You are right, I misinterpreted Mike's suggestion. I expected "Unit of work" to be an code process but it's a concept. The changes to related data rows of the table in the recipe unit must be handled by my python code not SqlAlchemy. Since reading your comments, I have begun to develop a

[sqlalchemy] Re: Update multiple rows in SQLite Databse

2020-08-27 Thread William Phillips
iminated some of the data to be updated and the file and line location. Can anyone help? On Friday, August 14, 2020 at 2:45:48 PM UTC-4 William Phillips wrote: > Thank Mike for the input. My preliminary research on "Unit of work" has > shown it is exactly what I need.

Re: [sqlalchemy] Re: Deletion of a row from an association table

2020-08-19 Thread William Phillips
y loaded > in your session won't be aware that the delete happened. If they had > already loaded their "parents" or "children" relationships, that > cached data will not match what is in the database. > > Hope that helps, > > Simon > > On Wed, Aug 12,

[sqlalchemy] Re: Update multiple rows in SQLite Databse

2020-08-14 Thread William Phillips
Thank Mike for the input. My preliminary research on "Unit of work" has shown it is exactly what I need. Still have to learn how to use it but I'll get there. Again thanks. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example

[sqlalchemy] Re: Deletion of a row from an association table

2020-08-11 Thread William Phillips
For the sake of completeness I am including the code to disconnect an option from a machine using only python/SQLite code. def removeOption(bladeKey, OptionKey): """ DELETE from blade_options WHERE blade_FK == ? AND options_FK == ? """ import sqlite3 dbPath =

[sqlalchemy] Re: Deletion of a row from an association table

2020-08-11 Thread William Phillips
. This is just pulling the plug between two rows in two different tables without changing the row data. Don't know if I am clear? On Tuesday, August 11, 2020 at 10:54:39 AM UTC-4, William Phillips wrote: > > I am working on an app using python3 and SqlAlchemy for SQLite3 database > m

[sqlalchemy] Re: Deletion of a row from an association table

2020-08-11 Thread William Phillips
full model for these 3 classes: # machine class Machine(Base): __tablename__ = 'machine' machine_ID = Column(Integer, primary_key=True) machine_Type = Column(Integer, nullable=False) machine_model = Column(String(10), nullable=False) machine_Weight = Column(Integer)

[sqlalchemy] Update multiple rows in SQLite Databse

2020-08-11 Thread William Phillips
I am developing a small cooking recipe application. I have a problem when it comes to updating data taken from a table (QTbableWidget). The updated data may contain more rows than the original already in the database ( or less). I usually use a dictionary with the keys corresponding to the

[sqlalchemy] Deletion of a row from an association table

2020-08-11 Thread William Phillips
I am working on an app using python3 and SqlAlchemy for SQLite3 database management. I have some tables that have a Many to Many relationship. I've created an association table to handle this relationship. Class Machine(Base): __tablename__ 'machine' machine_ID = Column(Integer,