Re: [sqlalchemy] Bulk insertion with null values

2016-01-07 Thread Tobias
statements is reduced. > > On 01/06/2016 03:45 PM, Tobias wrote: > > Hi, > > > > I am using Session.bulk_insert_mappings() > > < > http://docs.sqlalchemy.org/en/latest/orm/session_api.html#sqlalchemy.orm.session.Session.bulk_insert_mappings> >

[sqlalchemy] Bulk insertion with null values

2016-01-06 Thread Tobias
don't want to change the model because the bulk insertion is only used in the migration script. Here is an example: https://gist.github.com/tsauerwein/d9630336731fff0547ba Thanks, Tobias -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To

Re: [sqlalchemy] Force SQLAlchemy to not use Unicode

2013-10-02 Thread Tobias Bell
): if isinstance(column_info['type'], types.String): column_info['type'] = MyStringType(column_info['type'].length) m2 = MetaData() t2 = Table('t1', m2, autoload=True, autoload_with=e) e.execute(t2.select().where(t2.c.data == u'd1')).fetchall() On Oct 1, 2013, at 4:12 AM, Tobias Bell tobia

Re: [sqlalchemy] Force SQLAlchemy to not use Unicode

2013-10-01 Thread Tobias Bell
Am Montag, 30. September 2013 19:18:01 UTC+2 schrieb Michael Bayer: On Sep 30, 2013, at 9:30 AM, Tobias Bell tobia...@gmail.com javascript: wrote: Hello I'm currently migrating a rather old application built with SQLAlchemy 0.6 and also an older cx_oracle to use SQLAlchemy 0.8

[sqlalchemy] Force SQLAlchemy to not use Unicode

2013-09-30 Thread Tobias Bell
) - encoding parameter = param = param.encode('utf8') I found thishttps://groups.google.com/forum/#!msg/sqlalchemy/8Xn31vBfGKU/bAGLNKapvSMJ post, but couldn't use it because all my table definitions are autoloaded. What would you suggest? Best regards Tobias Bell -- You received this message because you

[sqlalchemy] Query.update() and joins

2013-05-09 Thread Tobias Bieniek
Hi guys, I have stripped down my problematic code to the following: http://pastebin.com/AvvEr103 I am trying to call the Query.update() method on a query that is using an innerjoin to load some more information that I use in a filter. If I use the same expression to query data everything

Re: [sqlalchemy] Postgres custom composite types

2013-03-27 Thread Tobias Bieniek
GeoAlchemy is for SQLALchemy =0.7.x GeoAlchemy2 if for SQLALchemy =0.8 Kamil is mostly right. GeoAlchemy2 v0.1 is published on PyPI now, and GeoAlchemy(1) is also still available. The latter is still compatible with SQLAlchemy 0.8 though, but GeoAlchemy2 has a much easier code base and

Re: [sqlalchemy] Postgres custom composite types

2013-03-26 Thread Tobias Bieniek
Hi Michael, thanks for the explanation on the key attribute. I ended up misunderstanding it at first, but it seems to work now. I had a few problems when I tried to use a UserDefinedType (e.g. geoalchemys Geometry) in the typemap, because it complained about a missing key attribute. I've

Re: [sqlalchemy] Postgres custom composite types

2013-03-25 Thread Tobias Bieniek
*Sorry, just noticed that I replied directly, instead of to the list. Here are the contents for everyone:* Thanks for you help. Using the FunctionElement worked quite well, but I had to tweak the constructor and assign the base parameter to self.key to make it work properly (failing stack trace

Re: [sqlalchemy] Postgres custom composite types

2013-03-24 Thread Tobias Bieniek
I've tried to extract the basic structure from this sample code and merge it into the GeoAlchemy2 project, but somehow it fails to work for my specific use-case: https://github.com/geoalchemy/geoalchemy2/pull/18 I'm trying something like: select([func.SomeFunction(table.c.some_column,

Re: [sqlalchemy] Postgres custom composite types

2013-03-24 Thread Tobias Bieniek
thanks for the quick reply! if you can package up a script with full context that would help, that pullreq appears to add a new type to a file and I don't see how that results in anything happening. you are right,

Re: [sqlalchemy] Postgres custom composite types

2013-03-24 Thread Tobias Bieniek
I've added a small standalone script at https://gist.github.com/Turbo87/5233888 The output is SELECT (SomeFunction(table.foo)).attr1 AS anon_1, without any FROM clause. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this

Re: [sqlalchemy] Joined Table Inheritance question

2011-03-10 Thread Tobias Müller
However in my case I don't want to be able to persist some random Employee. All my employees should be engineers or managers. Ideally some exception should be thrown if I try to add an Employee object to my session. Maybe something like this. But I'm not sure if it's the right way. It fails

[sqlalchemy] Re: Do not bind None values in insert/update statements?

2010-05-21 Thread Tobias
...@zzzcomputing.com wrote: On May 20, 2010, at 5:25 AM, Tobias wrote: Hi, I am working on Oracle support for GeoAlchemy and having problems when trying to insert NULL values into geometry columns. spot_null = Spot(spot_height=None, spot_location=None) session.add(spot_null

[sqlalchemy] Do not bind None values in insert/update statements?

2010-05-20 Thread Tobias
: spot_null = Spot(spot_height=None, spot_location=select([text('NULL')], from_obj=['dual'])) .. Thanks, Tobias [1]: http://sourceforge.net/mailarchive/message.php?msg_name=49F050EC.30205%40gmail.com -- You received this message because you are subscribed to the Google Groups sqlalchemy group

[sqlalchemy] Re: (NotSupportedError) Variable_TypeByValue(): unhandled data type cx_Oracle.OBJECT

2010-05-12 Thread Tobias
be the issue here is that cx_oracle.OBJECT is being used at all - SQLAlchemy is not aware of this type so it appears to be some guess that cx_oracle is making about input or output parameters. On May 10, 2010, at 10:39 AM, Tobias wrote: Hi! Using cx_oracle and SQLAlchemy 0.6 I am having troubles

[sqlalchemy] Re: Custom compiler for column is ignored when using aliases

2010-05-12 Thread Tobias
compiler.process(functions.wkb(element)) return compiler.visit_column(element) Thanks a lot, you are doing an awesome job! Tobias On May 11, 5:21 pm, Michael Bayer mike...@zzzcomputing.com wrote: now you're on the big stage where your column is properly recognzied, so you have to write

[sqlalchemy] Re: Custom compiler for column is ignored when using aliases

2010-05-11 Thread Tobias
= :ROWNUM_1) WHERE ora_rn :ora_rn_1 2010-05-11 08:28:33,857 INFO sqlalchemy.engine.base.Engine.0x...838c {'ROWNUM_1': 1, 'spot_id_1': 1, 'ora_rn_1': 0} Only the innermost query should contain SELECT SDO_UTIL.TO_WKBGEOMETRY(..). Tobias On May 10, 5:40 pm, Michael Bayer mike...@zzzcomputing.com

[sqlalchemy] Re: Custom compiler for column is ignored when using aliases

2010-05-11 Thread Tobias
, 2:41 pm, Michael Bayer mike...@zzzcomputing.com wrote: I would need fully working code to test.  just one python file with the minimal reproducing situation. On May 11, 2010, at 2:41 AM, Tobias wrote: Hi Michael, thanks for your reply. The current tip seems to fix that problem

[sqlalchemy] Custom compiler for column is ignored when using aliases

2010-05-10 Thread Tobias
= :spot_id_1) WHERE ROWNUM = :ROWNUM_1) WHERE ora_rn :ora_rn_1 What is going wrong? Thanks, Tobias [1]: http://download.oracle.com/docs/cd/E11882_01/appdev.112/e11830/sdo_objrelschema.htm#insertedID3 [2]: http://www.sqlalchemy.org/docs/ormtutorial.html#using-aliases [3]: http://bitbucket.org

[sqlalchemy] (NotSupportedError) Variable_TypeByValue(): unhandled data type cx_Oracle.OBJECT

2010-05-10 Thread Tobias
(func.SDO_UTIL.TO_WKTGEOMETRY(bindparam('', wkt, type_=LargeBinary))) What can I do? Thanks, Tobias -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy

[sqlalchemy] Oracle binding problem: (DatabaseError) ORA-01036: illegal variable name/number

2010-05-06 Thread Tobias
(:MDSYS.SDO_GEOMETRY_1, :MDSYS.SDO_GEOMETRY_2) = spot_location) \nWHERE ROWNUM = :ROWNUM_1) \nWHERE ora_rn :ora_rn_1' {'ora_rn_1': 0, 'ROWNUM_1': 1, u'MDSYS.SDO_GEOMETRY_2': 4326, u'MDSYS.SDO_GEOMETRY_1': 'POINT(0 0)'} Something is wrong about the escaping. Thanks, Tobias -- You received this message

[sqlalchemy] Re: Oracle binding problem: (DatabaseError) ORA-01036: illegal variable name/number

2010-05-06 Thread Tobias
) AS SDO_GEOMETRY_1 FROM dual) WHERE ROWNUM = :ROWNUM_1) WHERE ora_rn :ora_rn_1 2010-05-06 13:35:31,547 INFO sqlalchemy.engine.base.Engine.0x...a8ac {'ROWNUM_1': 1, 'SDO_GEOMETRY_3': 4326, 'SDO_GEOMETRY_2': 'POINT(0 0)', 'ora_rn_1': 0} (cx_Oracle.OBJECT object at 0x8c11da0,) On May 6, 10:37 am, Tobias

Re: [sqlalchemy] Re: Oracle binding problem: (DatabaseError) ORA-01036: illegal variable name/number

2010-05-06 Thread Tobias Sauerwein
constructing Function objects, which works fine. On Thu, May 6, 2010 at 4:52 PM, Michael Bayer mike...@zzzcomputing.comwrote: On May 6, 2010, at 7:47 AM, Tobias wrote: By accident I found out that the SQLAlchemy Function class has an attribute 'packagenames'. If you set this attribute

[sqlalchemy] Re: @compiles ignores inheritance

2010-03-31 Thread Tobias
Great! Thanks a lot, Michael. On Mar 30, 4:42 pm, Michael Bayer mike...@zzzcomputing.com wrote: Tobias wrote: Hi, So I thought I could write just one method, that is annotated with @compiles(__base_function), but this does not work. I have to write a method for each class

[sqlalchemy] @compiles ignores inheritance

2010-03-30 Thread Tobias
? Thank you, Tobias -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit

[sqlalchemy] Re: @compiles: only apply in select clause, but not in where clause

2010-03-23 Thread Tobias
take a look in **kw. there should be a within_columns_clause flag. if not, try 0.6beta2. if not there, let me know. Hi Michael, thanks for your reply! In 0.5.8 there was no within_columns_clause, but it is available in 0.6beta2. And it seems to do exactly what I need! Tobias -- You

[sqlalchemy] 0.5 - 0.6: Default parameters of Numeric changed?

2010-03-23 Thread Tobias
Is this change intended? Tobias -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options

[sqlalchemy] Re: 0.5 - 0.6: Default parameters of Numeric changed?

2010-03-23 Thread Tobias
This was fast! Thanks for the information. On Mar 23, 11:36 am, Wichert Akkerman wich...@wiggy.net wrote: On 3/23/10 11:33 , Tobias wrote: Hi, I just found out that the default parameters for sqlalchemy.types.Numeric changed in 0.6. 0.6beta2: http://www.sqlalchemy.org/docs

[sqlalchemy] @compiles: only apply in select clause, but not in where clause

2010-03-22 Thread Tobias
it work. My question is: Is there a way to determine if the attribute is used in the select clause, so that only then the name is surrounded by the function call? Or is there another possibility to use a different format than the database internal? Thank you, Tobias [1]: http://geoalchemy.org

[sqlalchemy] ORM-Query generates correct SQL but returns no result

2009-06-22 Thread Tobias Bell
? Regards Tobias Bell --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to sqlalchemy+unsubscr