diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-01-11 15:22:46 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-01-11 15:22:46 -0500 |
commit | 67e0f356b2093fdc03303d50be1f89e75e847c7f (patch) | |
tree | e2209edb3a8aeb16702bc47573b9809a8e521db5 /lib/sqlalchemy/sql/compiler.py | |
parent | 0342a4886f00b34cf02e0d2d986a0896ba946788 (diff) | |
download | sqlalchemy-67e0f356b2093fdc03303d50be1f89e75e847c7f.tar.gz |
- A TypeDecorator of Integer can be used with a primary key
column, and the "autoincrement" feature of various dialects
as well as the "sqlite_autoincrement" flag will honor
the underlying database type as being Integer-based.
[ticket:2005]
- Result-row processors are applied to pre-executed SQL
defaults, as well as cursor.lastrowid, when determining
the contents of result.inserted_primary_key.
[ticket:2006]
- Bind parameters present in the "columns clause" of a select
are now auto-labeled like other "anonymous" clauses,
which among other things allows their "type" to be meaningful
when the row is fetched, as in result row processors.
- TypeDecorator is present in the "sqlalchemy" import space.
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r-- | lib/sqlalchemy/sql/compiler.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 39d320ede..92110ca2a 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -268,6 +268,20 @@ class SQLCompiler(engine.Compiled): if value is not None ) + @util.memoized_property + def _pk_processors(self): + return [ + col.type._cached_result_processor(self.dialect, None) + for col in self.statement.table.primary_key + ] + + @util.memoized_property + def _prefetch_processors(self): + return [ + col.type._cached_result_processor(self.dialect, None) + for col in self.prefetch + ] + def is_subquery(self): return len(self.stack) > 1 @@ -612,6 +626,7 @@ class SQLCompiler(engine.Compiled): ) self.binds[bindparam.key] = self.binds[name] = bindparam + return self.bindparam_string(name) def render_literal_bindparam(self, bindparam, **kw): @@ -732,8 +747,7 @@ class SQLCompiler(engine.Compiled): not isinstance(column.table, sql.Select): return _CompileLabel(column, sql._generated_label(column.name)) elif not isinstance(column, - (sql._UnaryExpression, sql._TextClause, - sql._BindParamClause)) \ + (sql._UnaryExpression, sql._TextClause)) \ and (not hasattr(column, 'name') or \ isinstance(column, sql.Function)): return _CompileLabel(column, column.anon_label) |