Sorry for double posting. I pressed "Send" before I was ready...

Please let me know if I'm doing something wrong here:

[code]
    metadata = MetaData('sqlite:///first.sqlite')
    table = Table('my_table', metadata, Column('text', Unicode(16)))

    stmt = table.insert()

    parameters=dict(text='Hello, World!')
    print stmt.compile().params
    print stmt.params(parameters).compile().params
[/code]

The first print gives:
{'text': None}

The second crashes with:
  File "/tools/aticad/1.0/external/python-2.4.1/lib/python2.4/site-
packages/SQLAlchemy-0.5.0rc4-py2.4.egg/sqlalchemy/sql/expression.py",
line 3515, in _copy_internals
    self.parameters = self.parameters.copy()
AttributeError: 'NoneType' object has no attribute 'copy'

After doing this patch:
[patch]
--- /tool/tools/aticad/1.0/external/python-2.4.1/lib/python2.4/site-
packages/SQLAlchemy-0.5.0rc4-py2.4.egg/sqlalchemy/sql/
expression.py.orig    2008-11-20 15:13:38.080922000 -0800
+++ /tool/tools/aticad/1.0/external/python-2.4.1/lib/python2.4/site-
packages/SQLAlchemy-0.5.0rc4-py2.4.egg/sqlalchemy/sql/expression.py
2008-11-20 15:13:57.008589000 -0800
@@ -3511,8 +3511,8 @@
             return ()

     def _copy_internals(self, clone=_clone):
-        # TODO: coverage
-        self.parameters = self.parameters.copy()
+        if self.parameters is not None:
+            self.parameters = self.parameters.copy()

     @_generative
     def prefix_with(self, clause):
[/patch]

I get {'text': None} for the second print too.

I took this directly from the docs at
sqlalchemy.sql.expression.Insert.params.


Should I use 0.4 instead? Is it more stable / less broken?



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

Reply via email to