[sqlalchemy] Re: Cascade-Delete causes AssertionError (Tries to blank-out primary key ...)
On 14 Feb., 01:02, Michael Bayer [EMAIL PROTECTED] wrote: OK its fixed in r2314. the cascade from User.meta does take effect, This was fast ! I checked out r2314, and my old code (without delete-orphan) is working now. The only problem: I started to write a little beginners manual for the Parent/Child/Cascade issue, and now I have to rewrite it (how about re- introducing the bug ? ;-) ) Thank you very much. Ruben --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: query on table-inheritance, self-referencing mappers
taking a look, i think what you should do is use an alias of the table_Employee in your queries. since the engineer mapper is using joined table inheritance, the default table_Employee is already going to be involved in the query, so your external join condition needs to be off a distinct alias of it to prevent mixups. ok, aliasing table_employee (the base of Engineer) everywhere works. Then another question. The (2) is a sort of hand-made, (3,4) are programatical. The queries they produce are quite different - (2) joins .helper against tableEmployee while the other two join it against the whole polymorphic_union - which isn't needed (ehm, thats 2 pages sql for 10 classes). Is there a way to hint these not to do it, e.g. some mapper/query option or specify different mapper or something? i will probably generate clauses using (2) anyway, but just in case i want to have a door open... On Feb 13, 11:17 am, svilen [EMAIL PROTECTED] wrote: hi. Here is a simple case which does not work - or i cannot figure out how to make it work. 'give all engineers which have helper employee of age =20'; where Engineer inherits Employee via table-inheritance. i've tried multiple ways to achieve the result - neither works, in different ways. Some give empty result (2 3). IMO in these the FROM is missing a second table. (4) raises Exception about some column missing - but only if neither of other ways is tried before it; if some of the other ways is tried, this one does not raise and returns a result. (1) is for reference only; bye t-query.py 3KDownload --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Help get Wikipedia entry through review
I recently created a basic Wikipedia entry for SQLAlchemy: http://en.wikipedia.org/wiki/SQLAlchemy However it has been marked as being non-notable: An editor has expressed a concern that the subject of the article does not satisfy the notability guideline or one of the following guidelines for inclusion on Wikipedia ... If you are familiar with the subject matter, please expand the article to establish its notability, citing reliable sources. If notability cannot be established, the article is more likely to be considered for deletion, per Wikipedia:Guide to deletion. Is someone able to make the necessary modifications to get the article through review? Hamish --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: query on table-inheritance, self-referencing mappers
on the way of programaticaly constructing (2) - actualy like (4) is done internaly, it looks to me maybe Property.get_join( parent) can be hinted somehow.. e.g. in case of only-table_inheritance, using the base table would be enough. Maybe i can just change the parent mapper to the simple non-polymorphic one... Definitely Won't work in general case. if the referenced polym-union has any concrete-table (other than base one), then... no way, use the polym-union. awwwful. taking a look, i think what you should do is use an alias of the table_Employee in your queries. since the engineer mapper is using joined table inheritance, the default table_Employee is already going to be involved in the query, so your external join condition needs to be off a distinct alias of it to prevent mixups. ok, aliasing table_employee (the base of Engineer) everywhere works. Then another question. The (2) is a sort of hand-made, (3,4) are programatical. The queries they produce are quite different - (2) joins .helper against tableEmployee while the other two join it against the whole polymorphic_union - which isn't needed (ehm, thats 2 pages sql for 10 classes). Is there a way to hint these not to do it, e.g. some mapper/query option or specify different mapper or something? i will probably generate clauses using (2) anyway, but just in case i want to have a door open... On Feb 13, 11:17 am, svilen [EMAIL PROTECTED] wrote: hi. Here is a simple case which does not work - or i cannot figure out how to make it work. 'give all engineers which have helper employee of age =20'; where Engineer inherits Employee via table-inheritance. i've tried multiple ways to achieve the result - neither works, in different ways. Some give empty result (2 3). IMO in these the FROM is missing a second table. (4) raises Exception about some column missing - but only if neither of other ways is tried before it; if some of the other ways is tried, this one does not raise and returns a result. (1) is for reference only; bye t-query.py 3KDownload --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: MS-SQL: specifying COLUMNS_TABLE_SCHEMA, using table_iterator()
On Feb 13, 4:23 pm, Paul Johnston [EMAIL PROTECTED] wrote: Hi, I'm wondering where I can specify that the tables that I want are in the schema DataTables instead of 'dbo'. The engine.echo outuput shows It's an argument to Table() e.g. ke_contracts = Table('KEContracts', sa.metadata, autoload=True, schema=DataTables) The error when I do this is: !-- ~/Documents/DataProc/Development/data/source/KE_Agreements tbrannon -- ./proc.py conn_url mssql://perl2:[EMAIL PROTECTED]:1433/DATA Traceback (most recent call last): File ./proc.py, line 8, in module sa = data.config.db.sqlalchemy() File /Users/tbrannon/Documents/DataProc/Development/data/config/ db.py, line 10, in __init__ self.engine = create_engine(conn_url, schema=schema) File build/bdist.macosx-10.4-i386/egg/sqlalchemy/engine/ __init__.py, line 91, in create_engine File build/bdist.macosx-10.4-i386/egg/sqlalchemy/engine/ strategies.py, line 86, in create TypeError: Invalid argument(s) 'schema' sent to create_engine(), using configuration PyMSSQLDialect/QueuePool/Engine. Please check that the keyword arguments are appropriate for this combination of components. !-- ~/Documents/DataProc/Development/data/source/KE_Agreements tbrannon -- - The code is this: class sqlalchemy: def __init__(self, ip=24.129.182.44, db=DATA, schema=DataTables): conn_url = mssql://perl2:[EMAIL PROTECTED]:1433/%s % (ip, db) print conn_url, conn_url self.engine = create_engine(conn_url, schema=schema) self.engine.echo=True self.metadata = BoundMetaData(self.engine) sqlalchemy.exceptions.NoSuchTableError: KEContracts Were you expecting this error? Well KEContracts is in the DataTables schema, so, until I specify that as the schema, it wont be able to find it I'm wondering if you can make the schema argument blank and simply make the table schema-qualified? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: MS-SQL: specifying COLUMNS_TABLE_SCHEMA, using table_iterator()
On Feb 13, 4:23 pm, Paul Johnston [EMAIL PROTECTED] wrote: Hi, I'm wondering where I can specify that the tables that I want are in the schema DataTables instead of 'dbo'. The engine.echo outuput shows It's an argument to Table() e.g. ke_contracts = Table('KEContracts', sa.metadata, autoload=True, schema=DataTables) The latest svn SA shows the schema as hardcoded: class MSSQLDialect(ansisql.ANSIDialect): def __init__(self, module=None, auto_identity_insert=False, encoding=None, **params): self.module = module or dbmodule self.auto_identity_insert = auto_identity_insert ansisql.ANSIDialect.__init__(self, encoding=encoding, **params) self.set_default_schema_name(dbo) --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: MS-SQL: specifying COLUMNS_TABLE_SCHEMA, using table_iterator()
On Feb 13, 4:23 pm, Paul Johnston [EMAIL PROTECTED] wrote: Hi, I'm wondering where I can specify that the tables that I want are in the schema DataTables instead of 'dbo'. The engine.echo outuput shows It's an argument to Table() e.g. oh my bad an argument to _Table_ not create_engine()! damn, anyway, egnine.dialect.set_default_schema_name() is how I went about it. I wish I had closely read your original reply. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: Newbie question about select statement
Cristiano Paris wrote: I everyone. I'm pretty new to SQLAlchemy and never done much sql-related work in the past as well so this could possibly be a silly question. ... I ended up discovering SearchResult which does mostly of the things I need. Cristiano --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: Newbie question about select statement
Michael Bayer wrote: also look into the SelectResults extension which will do the somelist[90] == SELECT ... OFFSET 90 LIMIT 1 thing. its in the plugins section of the docs. Thanks to all. I don't why but I haven't received these two emails until now. Cristiano --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Adding a BLOB column to my Oracle database breaks my app
I've been using an Oracle database and reflection (i.e., autoload=True). I recently added a BLOB column to the database. I never did any modification to the Python application code yet. The application was made using Turbogears and it just serves two forms, one for inserting records and one for updating . I am still able to update records, but when I do an insert I get the error below. I tried the latest oracle.py (r2303) and get the same thing (I couldn't do an svn checkout of everything because of our companies firewall). Page handler: bound method Root.insertrequest of srt.controllers.Root object at 0x0180EDB0 Traceback (most recent call last): File c:\python24\lib\site-packages\CherryPy-2.2.1-py2.4.egg\cherrypy \_cphttptools.py, line 105, in _run self.main() File c:\python24\lib\site-packages\CherryPy-2.2.1-py2.4.egg\cherrypy \_cphttptools.py, line 254, in main body = page_handler(*virtual_path, **self.params) File string, line 3, in insertrequest File c:\python24\lib\site-packages\turbogears-1.0.1-py2.4.egg \turbogears\controllers.py, line 334, in expose output = database.run_with_transaction( File string, line 5, in run_with_transaction File c:\python24\lib\site-packages\turbogears-1.0.1-py2.4.egg \turbogears\database.py, line 347, in sa_rwt retval = dispatch_exception(e,args,kw) File c:\python24\lib\site-packages\turbogears-1.0.1-py2.4.egg \turbogears\database.py, line 345, in sa_rwt transaction.commit() File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\session.py, line 54, in commit self.session.flush() File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\session.py, line 220, in flush self.uow.flush(self, objects) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\unitofwork.py, line 194, in flush flush_context.execute() File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\unitofwork.py, line 333, in execute head.execute(self) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\unitofwork.py, line 470, in execute UOWExecutor().execute(trans, self) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\unitofwork.py, line 793, in execute self.execute_save_steps(trans, task) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\unitofwork.py, line 815, in execute_save_steps self.execute_childtasks(trans, task, False) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\unitofwork.py, line 841, in execute_childtasks self.execute(trans, child, isdelete) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\unitofwork.py, line 793, in execute self.execute_save_steps(trans, task) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\unitofwork.py, line 810, in execute_save_steps self.save_objects(trans, task) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\unitofwork.py, line 798, in save_objects task._save_objects(trans) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\unitofwork.py, line 461, in _save_objects self.mapper.save_obj(self.polymorphic_tosave_objects, trans) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\mapper.py, line 998, in save_obj c = connection.execute(statement, params) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\engine\base.py, line 258, in execute return Connection.executors[type(object).__mro__[-2]](self, object, *multiparams, **params) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\engine\base.py, line 282, in execute_clauseelement return self.execute_compiled(elem.compile(engine=self.__engine, parameters=param), *multiparams, **params) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\engine\base.py, line 297, in execute_compiled context.pre_exec(self.__engine, proxy, compiled, parameters) File C:\Python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\databases\oracle.py, line 152, in pre_exec super(OracleExecutionContext, self).pre_exec(engine, proxy, compiled, parameters) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\engine\default.py, line 128, in pre_exec self._process_defaults(engine, proxy, compiled, parameters) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\engine\default.py, line 204, in _process_defaults elif not param.has_key(c.key) or param[c.key] is None: File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\sql.py, line 321, in __getitem__ v = self.binds[key].typeprocess(v, self.dialect) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\sql.py, line 836, in typeprocess return