hey roger -

the fix for that issue is trivial, however the code which it fixes is  
doing something that should be done differently (that is, ensuring  
that all pk columns are present in an INSERT statement).   Since I  
dont have FB here, can you try out the attached patch and see if it  
works for you, not just for the "print i" part (that part works) but  
for running some actual INSERT statements (and maybe the ORM) a  
little bit as well ?

thanks

- mike


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Attachment: fb.patch
Description: Binary data



On May 30, 2007, at 1:57 PM, Roger Demetrescu wrote:

>
> Hi Michael,
>
> I don't know when the following problem began, but anyway, I've tested
> it with rev.2672 and the problem persists....
>
> Having this script:
>
> ==================================
> from sqlalchemy import *
>
> db = create_engine("firebird://user:[EMAIL PROTECTED]//database.fdb")
> metadata = BoundMetaData(db)
>
> pessoa_table = Table('pessoa', metadata,
>     Column('pes_id', Integer, primary_key=True),
>     Column('pes_data', DateTime),
>     Column('pes_nome', String(30)),
>     Column('pes_sobrenome', String(30)),
>     Column('pes_idade', Integer))
>
> s = pessoa_table.select()
> u = pessoa_table.update()
> i = pessoa_table.insert()
> ==================================
>
> ...and trying to print s, u and i in the shell, it gives me:
>
>
>
>>>> print s
> SELECT pessoa.pes_id, pessoa.pes_data, pessoa.pes_nome,
> pessoa.pes_sobrenome, pessoa.pes_idade
> FROM pessoa
>
>>>> print u
> UPDATE pessoa SET pes_id=?, pes_data=?, pes_nome=?,  
> pes_sobrenome=?, pes_idade=?
>
>>>> print i
> Traceback (most recent call last):
>   File "<pyshell#2>", line 1, in <module>
>     print i
>   File "d:\sqlalchemy\lib\sqlalchemy\sql.py", line 1225, in __str__
>     return unicode(self.compile()).encode('ascii', 'backslashreplace')
>   File "d:\sqlalchemy\lib\sqlalchemy\sql.py", line 1221, in compile
>     compiler.compile()
>   File "d:\sqlalchemy\lib\sqlalchemy\sql.py", line 1032, in compile
>     self.traverse(self.statement)
>   File "d:\sqlalchemy\lib\sqlalchemy\sql.py", line 877, in traverse
>     target.accept_visitor(v)
>   File "d:\sqlalchemy\lib\sqlalchemy\sql.py", line 3082, in  
> accept_visitor
>     visitor.visit_insert(self)
>   File "d:\sqlalchemy\lib\sqlalchemy\databases\firebird.py", line 324,
> in visit_insert
>     if not self.parameters.has_key(c.key):
> AttributeError: 'NoneType' object has no attribute 'has_key'
>>>>
>
>
>
> The strange thing is that I am able to execute the insert statement:
>
>>>> i.execute(pes_id=777)
> <sqlalchemy.engine.base.ResultProxy object at 0x016A3310>
>
>
>
> I am also having another problem with firebird, which may be related
> to this problem or not... I'll send other message to describe it...
>
>
> Thanks
>
> PS: I've done the same tests with Postgresql and it run fine....
>
> --~--~---------~--~----~------------~-------~--~----~
> 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- 
> [EMAIL PROTECTED]
> For more options, visit this group at http://groups.google.com/ 
> group/sqlalchemy?hl=en
> -~----------~----~----~----~------~----~------~--~---
>

Reply via email to