Re: [sqlalchemy] Using Python 'sorted' doesn't change data?
Great! Thank you for your answer and hints! Cheers On 11/08/2016 10:30 PM, mike bayer wrote: it does not, and as an exercise I'd recommend trying to theorize how sorted() *could* make such an effect - and if it did, what assumptions would it be making? Hopefully this would reveal that the assumptions the library would need to make in order to even make such a thing happen would not be appropriate (e.g., what column would it be changing? how would it know to change *that* column and not another one? what if your query.all() were against some other SQL statement? etc). On 11/08/2016 12:58 PM, TomS. wrote: Hi, I know this is silly question, but I just need confirmation - Python 'sorted' doesn't affect in any way data stored in DB? Example: class PPL(db.Model): person_pk_id = db.Column(db.Integer, primary_key=True) person_type = db.Column(db.Integer) person_order_s = db.Column(db.Integer) person_order_k = db.Column(db.Integer) all_ppl = PPL.query.all() technician = [person for person in all_ppl if person.person_type == 1] technician_sorted = sorted(technician, key=lambda k: getattr(k, u'person_order_' + extra_par)) Using 'sorted' won't make any changes in the rows which are in table used by PPL? Thank you very much! Cheers -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
Re: [sqlalchemy] Using Python 'sorted' doesn't change data?
it does not, and as an exercise I'd recommend trying to theorize how sorted() *could* make such an effect - and if it did, what assumptions would it be making? Hopefully this would reveal that the assumptions the library would need to make in order to even make such a thing happen would not be appropriate (e.g., what column would it be changing? how would it know to change *that* column and not another one? what if your query.all() were against some other SQL statement? etc). On 11/08/2016 12:58 PM, TomS. wrote: Hi, I know this is silly question, but I just need confirmation - Python 'sorted' doesn't affect in any way data stored in DB? Example: class PPL(db.Model): person_pk_id = db.Column(db.Integer, primary_key=True) person_type = db.Column(db.Integer) person_order_s = db.Column(db.Integer) person_order_k = db.Column(db.Integer) all_ppl = PPL.query.all() technician = [person for person in all_ppl if person.person_type == 1] technician_sorted = sorted(technician, key=lambda k: getattr(k, u'person_order_' + extra_par)) Using 'sorted' won't make any changes in the rows which are in table used by PPL? Thank you very much! Cheers -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
[sqlalchemy] Using Python 'sorted' doesn't change data?
Hi, I know this is silly question, but I just need confirmation - Python 'sorted' doesn't affect in any way data stored in DB? Example: class PPL(db.Model): person_pk_id = db.Column(db.Integer, primary_key=True) person_type = db.Column(db.Integer) person_order_s = db.Column(db.Integer) person_order_k = db.Column(db.Integer) all_ppl = PPL.query.all() technician = [person for person in all_ppl if person.person_type == 1] technician_sorted = sorted(technician, key=lambda k: getattr(k, u'person_order_' + extra_par)) Using 'sorted' won't make any changes in the rows which are in table used by PPL? Thank you very much! Cheers -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.