Re: [sqlalchemy] How to convert character set of the column with sqlalchemy?

2017-12-20 Thread Ken Liu
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 <liuji...@gmail.com > 
> 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.dialects.mysql import CHAR 
>
> cast(Channel.cname, CHAR(charset="gbk")) 
>
>
>
> > 
> > -- 
> > 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+...@googlegroups.com . 
> > To post to this group, send email to sqlal...@googlegroups.com 
> . 
> > Visit this group at https://groups.google.com/group/sqlalchemy. 
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
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] How to convert character set of the column with sqlalchemy?

2017-12-20 Thread Ken Liu


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, 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.