[MonetDB-users] Howto query with non ascii in python?

How do I run non-ascii queries in python? Or from the command line for that matter? Naive tests on my part fail.... python: RuntimeError: !syntax error, unexpected IDENT, expecting INTERSECT or EXCEPT or UNION in: "select name from tables where system=false and name=unitéble2" commandline: sql>select name from tables where system=false and name=unitéble2; !syntax error, unexpected IDENT, expecting INTERSECT or EXCEPT or UNION in: "select name from tables where system=false and name=unitéble2" Thanks -matt

On Thu, Nov 29, 2007 at 04:15:37PM -0700, m h wrote:
How do I run non-ascii queries in python? Or from the command line for that matter?
Naive tests on my part fail....
python: RuntimeError: !syntax error, unexpected IDENT, expecting INTERSECT or EXCEPT or UNION in: "select name from tables where system=false and name=unitéble2"
commandline: sql>select name from tables where system=false and name=unitéble2; !syntax error, unexpected IDENT, expecting INTERSECT or EXCEPT or UNION in: "select name from tables where system=false and name=unitéble2"
It should be possible to send 'utf-8' encoded string/identfiers etc. and running the query via mclient works fine. sql>select name from tables where system=false and name=unitéble2; !SELECT: identifier 'unitéble2' unknown Niels
Thanks
-matt
------------------------------------------------------------------------- SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- Niels Nes, Centre for Mathematics and Computer Science (CWI) Kruislaan 413, 1098 SJ Amsterdam, The Netherlands room C0.02, phone ++31 20 592-4098, fax ++31 20 592-4312 url: http://www.cwi.nl/~niels e-mail: Niels.Nes@cwi.nl

On 30/11/2007, m h
How do I run non-ascii queries in python? Or from the command line for that matter?
Naive tests on my part fail....
Hi Matt, the following script works fine for me as can be seen in the attached screenshot. Markus --- # -*- coding: utf-8 -*- import MonetSQLdb x = MonetSQLdb.connect() c = x.cursor() c.execute('DROP TABLE test') c.execute('CREATE TABLE test(id int, name varchar(20))') c.execute('INSERT INTO test (id, name) VALUES (%s, %s)', (0, 'ä ö ü €')) c.execute('SELECT * FROM test') value = c.fetchone()[-1] print type(value) print value print unicode(value, 'utf-8').encode('windows-1252') c.close() x.close()
participants (3)
-
m h
-
Markus Gritsch
-
Niels Nes