very good! It's fine. thank you, Mike Bayer !
On Wednesday, December 20, 2017 at 10:08:49 PM UTC+8, Mike Bayer wrote:
>
> On Wed, Dec 20, 2017 at 4:36 AM, Ken Liu >
> wrote:
> > I want to convert query.order_by(cast(Channel.cname, String) to
> cast(cname
> > AS CHAR CHARACTER SET gbk),how do I
I moved `db.session.commit()` outside the loop. That seemed to fix the
error. I'll post an update if I get more errors.
On Wednesday, December 20, 2017 at 6:43:05 PM UTC-5, Lele Gaifax wrote:
>
> Tom Tanner > writes:
>
> > I want to query rows and copy them while changing an attribute of each.
On Wed, Dec 20, 2017 at 5:38 PM, Tom Tanner
wrote:
> I want to query rows and copy them while changing an attribute of each.
> Here's my code.
>
> colObjs= db.session.query(Column).filter_by(chart_id=oldChartID).all()
> for colObj in colObjs:
>make_transient(colObj)
>print colObj.id
>
Tom Tanner writes:
> I want to query rows and copy them while changing an attribute of each.
> Here's my code.
>
> colObjs= db.session.query(Column).filter_by(chart_id=oldChartID).all()
> for colObj in colObjs:
>make_transient(colObj)
>print colObj.id
>del colObj.id
>colObj.cha
I want to query rows and copy them while changing an attribute of each.
Here's my code.
colObjs= db.session.query(Column).filter_by(chart_id=oldChartID).all()
for colObj in colObjs:
make_transient(colObj)
print colObj.id
del colObj.id
colObj.chart_id= newChartID
db.session.add(co
Thank you
On Wednesday, December 20, 2017 at 8:37:57 AM UTC-5, Lele Gaifax wrote:
>
> Tom Tanner > writes:
>
> > Lele, could you write the code showing how that would look? Thanks.
>
> Extending Mike's answer:
>
> from sqlalchemy.orm import make_transient
> make_transient(someObj) #
On Wed, Dec 20, 2017 at 4:36 AM, Ken Liu wrote:
> I want to convert query.order_by(cast(Channel.cname, String) to cast(cname
> AS CHAR CHARACTER SET gbk),how do I do that? please help me.
this looks like MySQL so the character set option is present in the
MySQL CHAR type:
from sqlalchemy.dialect
Tom Tanner writes:
> Lele, could you write the code showing how that would look? Thanks.
Extending Mike's answer:
from sqlalchemy.orm import make_transient
make_transient(someObj) # someObj is no longer in the session
del someObj.id# assume this is the primary key
I want to convert query.order_by(cast(Channel.cname, String) to cast(cname AS
CHAR CHARACTER SET gbk),how do I do that? please help me.
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Comp
Lele, could you write the code showing how that would look? Thanks.
On Wednesday, December 20, 2017 at 2:22:49 AM UTC-5, Lele Gaifax wrote:
>
> Tom Tanner > writes:
>
> > Thanks, I used the first method. Follow up question: How do I get the
> new
> > primary key after running `session.commit()`
10 matches
Mail list logo