summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2008-10-18 18:14:06 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2008-10-18 18:14:06 +0000
commita20222fc22059df30b09b49621a784b54919613a (patch)
tree99d99b2516fa81520ae1878e31e638f188ccc40f
parent223bd3688dfd01f9dff973cbf9b3d92f39df4c21 (diff)
downloadsqlalchemy-a20222fc22059df30b09b49621a784b54919613a.tar.gz
- 0.5.0rc3, doh
- The internal notion of an "OID" or "ROWID" column has been removed. It's basically not used by any dialect, and the possibility of its usage with psycopg2's cursor.lastrowid is basically gone now that INSERT..RETURNING is available. - Removed "default_order_by()" method on all FromClause objects. - profile/compile/select test is 8 function calls over on buildbot 2.4 for some reason, will adjust after checking the results of this commit
-rw-r--r--CHANGES40
-rw-r--r--VERSION2
-rw-r--r--lib/sqlalchemy/databases/informix.py11
-rw-r--r--lib/sqlalchemy/databases/oracle.py6
-rw-r--r--lib/sqlalchemy/databases/postgres.py22
-rw-r--r--lib/sqlalchemy/databases/sqlite.py3
-rw-r--r--lib/sqlalchemy/engine/base.py17
-rw-r--r--lib/sqlalchemy/engine/default.py3
-rw-r--r--lib/sqlalchemy/schema.py23
-rw-r--r--lib/sqlalchemy/sql/compiler.py12
-rw-r--r--lib/sqlalchemy/sql/expression.py40
-rw-r--r--test/dialect/oracle.py10
-rw-r--r--test/orm/assorted_eager.py6
-rw-r--r--test/orm/mapper.py14
-rw-r--r--test/profiling/zoomark_orm.py2
-rw-r--r--test/sql/labels.py11
-rw-r--r--test/sql/select.py4
-rwxr-xr-xtest/sql/selectable.py20
18 files changed, 59 insertions, 187 deletions
diff --git a/CHANGES b/CHANGES
index 29a52fb3f..62b3ca77e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -3,6 +3,31 @@
=======
CHANGES
=======
+0.5.0rc3
+========
+- orm
+ - "not equals" comparisons of simple many-to-one relation
+ to an instance will not drop into an EXISTS clause
+ and will compare foreign key columns instead.
+
+ - removed not-really-working use cases of comparing
+ a collection to an iterable. Use contains() to test
+ for collection membership.
+
+- sql
+ - Further simplified SELECT compilation and its relationship
+ to result row processing.
+
+ - Direct execution of a union() construct will properly set up
+ result-row processing. [ticket:1194]
+
+ - The internal notion of an "OID" or "ROWID" column has been
+ removed. It's basically not used by any dialect, and the
+ possibility of its usage with psycopg2's cursor.lastrowid
+ is basically gone now that INSERT..RETURNING is available.
+
+ - Removed "default_order_by()" method on all FromClause
+ objects.
0.5.0rc2
========
@@ -60,25 +85,11 @@ CHANGES
"clean" objects to better protect against operating on
objects as they're asynchronously gc'ed. [ticket:1182]
- - "not equals" comparisons of simple many-to-one relation
- to an instance will not drop into an EXISTS clause
- and will compare foreign key columns instead.
-
- - removed not-really-working use cases of comparing
- a collection to an iterable. Use contains() to test
- for collection membership.
-
- sql
- column.in_(someselect) can now be used as a columns-clause
expression without the subquery bleeding into the FROM clause
[ticket:1074]
- - Further simplified SELECT compilation and its relationship
- to result row processing.
-
- - Direct execution of a union() construct will properly set up
- result-row processing. [ticket:1194]
-
- sqlite
- Overhauled SQLite date/time bind/result processing to use
regular expressions and format strings, rather than
@@ -98,6 +109,7 @@ CHANGES
- Oracle will detect string-based statements which contain
comments at the front before a SELECT as SELECT statements.
[ticket:1187]
+
0.5.0rc1
========
diff --git a/VERSION b/VERSION
index 9bd452b25..e0c58611f 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.5.0rc2
+0.5.0rc3
diff --git a/lib/sqlalchemy/databases/informix.py b/lib/sqlalchemy/databases/informix.py
index 423226c18..27554d37e 100644
--- a/lib/sqlalchemy/databases/informix.py
+++ b/lib/sqlalchemy/databases/informix.py
@@ -242,9 +242,6 @@ class InfoDialect(default.DefaultDialect):
def create_execution_context(self , *args, **kwargs):
return InfoExecutionContext(self, *args, **kwargs)
- def oid_column_name(self, column):
- return "rowid"
-
def table_names(self, connection, schema):
s = "select tabname from systables"
return [row[0] for row in connection.execute(s)]
@@ -396,7 +393,7 @@ class InfoCompiler(compiler.DefaultCompiler):
# TODO: dont modify the original select, generate a new one
a = [ __label(c) for c in select._raw_columns ]
for c in select._order_by_clause.clauses:
- if ( __label(c) not in a ) and getattr( c , 'name' , '' ) != 'oid':
+ if ( __label(c) not in a ):
select.append_column( c )
return compiler.DefaultCompiler.visit_select(self, select)
@@ -415,11 +412,7 @@ class InfoCompiler(compiler.DefaultCompiler):
return compiler.DefaultCompiler.visit_function( self , func )
def visit_clauselist(self, list, **kwargs):
- try:
- li = [ c for c in list.clauses if c.name != 'oid' ]
- except:
- li = [ c for c in list.clauses ]
- return ', '.join([s for s in [self.process(c) for c in li] if s is not None])
+ return ', '.join([s for s in [self.process(c) for c in list.clauses] if s is not None])
class InfoSchemaGenerator(compiler.SchemaGenerator):
def get_column_specification(self, column, first_pk=False):
diff --git a/lib/sqlalchemy/databases/oracle.py b/lib/sqlalchemy/databases/oracle.py
index eb02d4505..3f2540ac0 100644
--- a/lib/sqlalchemy/databases/oracle.py
+++ b/lib/sqlalchemy/databases/oracle.py
@@ -325,12 +325,6 @@ class OracleDialect(default.DefaultDialect):
def type_descriptor(self, typeobj):
return sqltypes.adapt_type(typeobj, colspecs)
- def oid_column_name(self, column):
- if not isinstance(column.table, (sql.TableClause, sql.Select)):
- return None
- else:
- return "rowid"
-
def create_xid(self):
"""create a two-phase transaction ID.
diff --git a/lib/sqlalchemy/databases/postgres.py b/lib/sqlalchemy/databases/postgres.py
index aeed41078..1c410af53 100644
--- a/lib/sqlalchemy/databases/postgres.py
+++ b/lib/sqlalchemy/databases/postgres.py
@@ -292,19 +292,6 @@ class PGExecutionContext(default.DefaultExecutionContext):
else:
return base.ResultProxy(self)
- def post_exec(self):
- if self.compiled.isinsert and self.last_inserted_ids is None:
- if not self.dialect.use_oids:
- pass
- # will raise invalid error when they go to get them
- else:
- table = self.compiled.statement.table
- if self.cursor.lastrowid is not None and table is not None and len(table.primary_key):
- s = sql.select(table.primary_key, table.oid_column == self.cursor.lastrowid)
- row = self.connection.execute(s).fetchone()
- self._last_inserted_ids = [v for v in row]
- super(PGExecutionContext, self).post_exec()
-
class PGDialect(default.DefaultDialect):
name = 'postgres'
supports_alter = True
@@ -316,9 +303,8 @@ class PGDialect(default.DefaultDialect):
supports_pk_autoincrement = False
default_paramstyle = 'pyformat'
- def __init__(self, use_oids=False, server_side_cursors=False, **kwargs):
+ def __init__(self, server_side_cursors=False, **kwargs):
default.DefaultDialect.__init__(self, **kwargs)
- self.use_oids = use_oids
self.server_side_cursors = server_side_cursors
def dbapi(cls):
@@ -382,12 +368,6 @@ class PGDialect(default.DefaultDialect):
else:
return self.context.last_inserted_ids
- def oid_column_name(self, column):
- if self.use_oids:
- return "oid"
- else:
- return None
-
def has_table(self, connection, table_name, schema=None):
# seems like case gets folded in pg_class...
if schema is None:
diff --git a/lib/sqlalchemy/databases/sqlite.py b/lib/sqlalchemy/databases/sqlite.py
index 35f07b784..70c3f74ec 100644
--- a/lib/sqlalchemy/databases/sqlite.py
+++ b/lib/sqlalchemy/databases/sqlite.py
@@ -298,9 +298,6 @@ class SQLiteDialect(default.DefaultDialect):
def create_execution_context(self, connection, **kwargs):
return SQLiteExecutionContext(self, connection, **kwargs)
- def oid_column_name(self, column):
- return "oid"
-
def is_disconnect(self, e):
return isinstance(e, self.dbapi.ProgrammingError) and "Cannot operate on a closed database." in str(e)
diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py
index 1e72bc14b..8e8a7528b 100644
--- a/lib/sqlalchemy/engine/base.py
+++ b/lib/sqlalchemy/engine/base.py
@@ -128,23 +128,6 @@ class Dialect(object):
raise NotImplementedError()
- def oid_column_name(self, column):
- """Return the oid column name for this Dialect
-
- May return ``None`` if the dialect can't o won't support
- OID/ROWID features.
-
- The [sqlalchemy.schema#Column] instance which represents OID
- for the query being compiled is passed, so that the dialect
- can inspect the column and its parent selectable to determine
- if OID/ROWID is not selected for a particular selectable
- (i.e. Oracle doesnt support ROWID for UNION, GROUP BY,
- DISTINCT, etc.)
- """
-
- raise NotImplementedError()
-
-
def server_version_info(self, connection):
"""Return a tuple of the database's version number."""
diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py
index a3ae6d456..a90142702 100644
--- a/lib/sqlalchemy/engine/default.py
+++ b/lib/sqlalchemy/engine/default.py
@@ -75,9 +75,6 @@ class DefaultDialect(base.Dialect):
if len(ident) > self.max_identifier_length:
raise exc.IdentifierError("Identifier '%s' exceeds maximum length of %d characters" % (ident, self.max_identifier_length))
- def oid_column_name(self, column):
- return None
-
def do_begin(self, connection):
"""Implementations might want to put logic here for turning
autocommit on/off, etc.
diff --git a/lib/sqlalchemy/schema.py b/lib/sqlalchemy/schema.py
index d66a51de4..334c277b4 100644
--- a/lib/sqlalchemy/schema.py
+++ b/lib/sqlalchemy/schema.py
@@ -491,10 +491,6 @@ class Column(SchemaItem, expression._ColumnClause):
Strings and text() will be converted into a ``DefaultClause``
object upon initialization.
- _is_oid
- Defaults to False: used internally to indicate that this column is
- used as the quasi-hidden "oid" column
-
index
Defaults to False: indicates that this column is indexed. The name
of the index is autogenerated. to specify indexes with explicit
@@ -566,7 +562,6 @@ class Column(SchemaItem, expression._ColumnClause):
self.key = kwargs.pop('key', name)
self.primary_key = kwargs.pop('primary_key', False)
self.nullable = kwargs.pop('nullable', not self.primary_key)
- self._is_oid = kwargs.pop('_is_oid', False)
self.default = kwargs.pop('default', None)
self.server_default = kwargs.pop('server_default', None)
self.server_onupdate = kwargs.pop('server_onupdate', None)
@@ -640,12 +635,9 @@ class Column(SchemaItem, expression._ColumnClause):
self.metadata = table.metadata
if getattr(self, 'table', None) is not None:
raise exc.ArgumentError("this Column already has a table!")
- if not self._is_oid:
- self._pre_existing_column = table._columns.get(self.key)
- table._columns.replace(self)
- else:
- self._pre_existing_column = None
+ self._pre_existing_column = table._columns.get(self.key)
+ table._columns.replace(self)
if self.primary_key:
table.primary_key.replace(self)
@@ -703,7 +695,7 @@ class Column(SchemaItem, expression._ColumnClause):
This is used in ``Table.tometadata``.
"""
- return Column(self.name, self.type, self.default, key = self.key, primary_key = self.primary_key, nullable = self.nullable, _is_oid = self._is_oid, quote=self.quote, index=self.index, autoincrement=self.autoincrement, *[c.copy() for c in self.constraints])
+ return Column(self.name, self.type, self.default, key = self.key, primary_key = self.primary_key, nullable = self.nullable, quote=self.quote, index=self.index, autoincrement=self.autoincrement, *[c.copy() for c in self.constraints])
def _make_proxy(self, selectable, name=None):
"""Create a *proxy* for this column.
@@ -713,14 +705,13 @@ class Column(SchemaItem, expression._ColumnClause):
"""
fk = [ForeignKey(f._colspec) for f in self.foreign_keys]
- c = Column(name or self.name, self.type, self.default, key = name or self.key, primary_key = self.primary_key, nullable = self.nullable, _is_oid = self._is_oid, quote=self.quote, *fk)
+ c = Column(name or self.name, self.type, self.default, key = name or self.key, primary_key = self.primary_key, nullable = self.nullable, quote=self.quote, *fk)
c.table = selectable
c.proxies = [self]
c._pre_existing_column = self._pre_existing_column
- if not c._is_oid:
- selectable.columns.add(c)
- if self.primary_key:
- selectable.primary_key.add(c)
+ selectable.columns.add(c)
+ if self.primary_key:
+ selectable.primary_key.add(c)
[c._init_items(f) for f in fk]
return c
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py
index 573453499..6d3769906 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -148,7 +148,7 @@ class DefaultCompiler(engine.Compiled):
# actually present in the generated SQL
self.bind_names = {}
- # a stack. what recursive compiler doesn't have a stack ? :)
+ # stack which keeps track of nested SELECT statements
self.stack = []
# relates label names in the final SQL to
@@ -236,15 +236,7 @@ class DefaultCompiler(engine.Compiled):
def visit_column(self, column, result_map=None, **kwargs):
- if column._is_oid:
- name = self.dialect.oid_column_name(column)
- if name is None:
- if len(column.table.primary_key) != 0:
- pk = list(column.table.primary_key)[0]
- return self.visit_column(pk, result_map=result_map, **kwargs)
- else:
- return None
- elif not column.is_literal:
+ if not column.is_literal:
name = self._truncated_identifier("colident", column.name)
else:
name = column.name
diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py
index 8f611c05e..2663c61a1 100644
--- a/lib/sqlalchemy/sql/expression.py
+++ b/lib/sqlalchemy/sql/expression.py
@@ -1689,9 +1689,6 @@ class FromClause(Selectable):
def _get_from_objects(self, **modifiers):
return []
- def default_order_by(self):
- return [self.oid_column]
-
def count(self, whereclause=None, **params):
"""return a SELECT COUNT generated against this ``FromClause``."""
@@ -1769,8 +1766,6 @@ class FromClause(Selectable):
col, intersect = None, None
target_set = column.proxy_set
cols = self.c
- if self.oid_column:
- cols += [self.oid_column]
for c in cols:
i = c.proxy_set.intersection(target_set)
if i and \
@@ -1793,7 +1788,7 @@ class FromClause(Selectable):
# from the item. this is because FromClause subclasses, when
# cloned, need to reestablish new "proxied" columns that are
# linked to the new item
- for attr in ('_columns', '_primary_key' '_foreign_keys', '_oid_column', '_embedded_columns', '_all_froms'):
+ for attr in ('_columns', '_primary_key' '_foreign_keys', '_embedded_columns', '_all_froms'):
if hasattr(self, attr):
delattr(self, attr)
@@ -1810,7 +1805,6 @@ class FromClause(Selectable):
columns = c = _expr_attr_func('_columns')
primary_key = _expr_attr_func('_primary_key')
foreign_keys = _expr_attr_func('_foreign_keys')
- oid_column = _expr_attr_func('_oid_column')
def _export_columns(self):
"""Initialize column collections."""
@@ -1820,7 +1814,6 @@ class FromClause(Selectable):
self._columns = ColumnCollection()
self._primary_key = ColumnSet()
self._foreign_keys = set()
- self._oid_column = None
self._populate_column_collection()
def _populate_column_collection(self):
@@ -1949,7 +1942,6 @@ class _TextClause(ClauseElement):
supports_execution = True
_hide_froms = []
- oid_column = None
def __init__(self, text = "", bind=None, bindparams=None, typemap=None, autocommit=False):
self._bind = bind
@@ -2356,7 +2348,6 @@ class Join(FromClause):
(c for c in columns if c.primary_key), self.onclause))
self._columns.update((col._label, col) for col in columns)
self._foreign_keys.update(itertools.chain(*[col.foreign_keys for col in columns]))
- self._oid_column = self.left.oid_column
def _copy_internals(self, clone=_clone):
self._reset_exported()
@@ -2462,8 +2453,6 @@ class Alias(FromClause):
def _populate_column_collection(self):
for col in self.element.columns:
col._make_proxy(self)
- if self.element.oid_column is not None:
- self._oid_column = self.element.oid_column._make_proxy(self)
def _copy_internals(self, clone=_clone):
self._reset_exported()
@@ -2636,12 +2625,11 @@ class _ColumnClause(_Immutable, ColumnElement):
``_ColumnClause``.
"""
- def __init__(self, text, selectable=None, type_=None, _is_oid=False, is_literal=False):
+ def __init__(self, text, selectable=None, type_=None, is_literal=False):
ColumnElement.__init__(self)
self.key = self.name = text
self.table = selectable
self.type = sqltypes.to_instance(type_)
- self._is_oid = _is_oid
self.__label = None
self.is_literal = is_literal
@@ -2690,9 +2678,9 @@ class _ColumnClause(_Immutable, ColumnElement):
# propigate the "is_literal" flag only if we are keeping our name,
# otherwise its considered to be a label
is_literal = self.is_literal and (name is None or name == self.name)
- c = _ColumnClause(name or self.name, selectable=selectable, _is_oid=self._is_oid, type_=self.type, is_literal=is_literal)
+ c = _ColumnClause(name or self.name, selectable=selectable, type_=self.type, is_literal=is_literal)
c.proxies = [self]
- if attach and not self._is_oid:
+ if attach:
selectable.columns[c.name] = c
return c
@@ -2712,7 +2700,6 @@ class TableClause(_Immutable, FromClause):
def __init__(self, name, *columns):
super(TableClause, self).__init__()
self.name = self.fullname = name
- self._oid_column = _ColumnClause('oid', self, _is_oid=True)
self._columns = ColumnCollection()
self._primary_key = ColumnSet()
self._foreign_keys = set()
@@ -2942,15 +2929,6 @@ class CompoundSelect(_SelectBaseMixin, FromClause):
proxy = cols[0]._make_proxy(self, name=self.use_labels and cols[0]._label or None)
proxy.proxies = cols
- oid_proxies = [
- c for c in [f.oid_column for f in self.selects] if c is not None
- ]
-
- if oid_proxies:
- col = oid_proxies[0]._make_proxy(self)
- col.proxies = oid_proxies
- self._oid_column = col
-
def _copy_internals(self, clone=_clone):
self._reset_exported()
self.selects = [clone(s) for s in self.selects]
@@ -3283,16 +3261,6 @@ class Select(_SelectBaseMixin, FromClause):
def _populate_column_collection(self):
for c in self.__exportable_columns():
c._make_proxy(self, name=self.use_labels and c._label or None)
-
- oid_proxies = [c for c in
- [f.oid_column for f in self.locate_all_froms()
- if f is not self] if c is not None
- ]
-
- if oid_proxies:
- col = oid_proxies[0]._make_proxy(self)
- col.proxies = oid_proxies
- self._oid_column = col
def self_group(self, against=None):
"""return a 'grouping' construct as per the ClauseElement specification.
diff --git a/test/dialect/oracle.py b/test/dialect/oracle.py
index 6803508f5..952df2901 100644
--- a/test/dialect/oracle.py
+++ b/test/dialect/oracle.py
@@ -129,7 +129,7 @@ AND mytable.myid = myothertable.otherid(+)",
query = table1.join(table2, table1.c.myid==table2.c.otherid).outerjoin(table3, table3.c.userid==table2.c.otherid)
- self.assert_compile(query.select().order_by(table1.oid_column).limit(10).offset(5),
+ self.assert_compile(query.select().order_by(table1.c.name).limit(10).offset(5),
"SELECT myid, name, description, otherid, othername, userid, "
"otherstuff FROM (SELECT /*+ FIRST_ROWS(10) */ myid, name, description, "
@@ -138,7 +138,7 @@ AND mytable.myid = myothertable.otherid(+)",
"myothertable.otherid AS otherid, myothertable.othername AS othername, "
"thirdtable.userid AS userid, thirdtable.otherstuff AS otherstuff FROM mytable, "
"myothertable, thirdtable WHERE thirdtable.userid(+) = myothertable.otherid AND "
- "mytable.myid = myothertable.otherid ORDER BY mytable.rowid) WHERE "
+ "mytable.myid = myothertable.otherid ORDER BY mytable.name) WHERE "
"ROWNUM <= :ROWNUM_1) WHERE ora_rn > :ora_rn_1", dialect=oracle.dialect(use_ansi=False))
def test_alias_outer_join(self):
@@ -157,11 +157,11 @@ AND mytable.myid = myothertable.otherid(+)",
s = select([at_alias, addresses]).\
select_from(addresses.outerjoin(at_alias, addresses.c.address_type_id==at_alias.c.id)).\
where(addresses.c.user_id==7).\
- order_by(addresses.oid_column, address_types.oid_column)
+ order_by(addresses.c.id, address_types.c.id)
self.assert_compile(s, "SELECT address_types_1.id, address_types_1.name, addresses.id, addresses.user_id, "
"addresses.address_type_id, addresses.email_address FROM addresses LEFT OUTER JOIN address_types address_types_1 "
- "ON addresses.address_type_id = address_types_1.id WHERE addresses.user_id = :user_id_1 ORDER BY addresses.rowid, "
- "address_types.rowid")
+ "ON addresses.address_type_id = address_types_1.id WHERE addresses.user_id = :user_id_1 ORDER BY addresses.id, "
+ "address_types.id")
class MultiSchemaTest(TestBase, AssertsCompiledSQL):
"""instructions:
diff --git a/test/orm/assorted_eager.py b/test/orm/assorted_eager.py
index ab59d5a44..a0c049fdd 100644
--- a/test/orm/assorted_eager.py
+++ b/test/orm/assorted_eager.py
@@ -646,17 +646,17 @@ class EagerTest7(_base.MappedTest):
mapper(Address, addresses, properties={
'phones': relation(Phone, lazy=False, backref='address',
- order_by=phone_numbers.default_order_by())})
+ order_by=phone_numbers.c.phone_id)})
mapper(Company, companies, properties={
'addresses': relation(Address, lazy=False, backref='company',
- order_by=addresses.default_order_by())})
+ order_by=addresses.c.address_id)})
mapper(Item, items)
mapper(Invoice, invoices, properties={
'items': relation(Item, lazy=False, backref='invoice',
- order_by=items.default_order_by()),
+ order_by=items.c.item_id),
'company': relation(Company, lazy=False, backref='invoices')})
c1 = Company(company_name='company 1', addresses=[
diff --git a/test/orm/mapper.py b/test/orm/mapper.py
index 7b293e564..8978059de 100644
--- a/test/orm/mapper.py
+++ b/test/orm/mapper.py
@@ -519,7 +519,7 @@ class MapperTest(_fixtures.FixtureTest):
users.c.id == addresses.c.user_id,
group_by=[c for c in users.c]).alias('myselect')
- mapper(User, s, order_by=s.default_order_by())
+ mapper(User, s, order_by=s.c.id)
sess = create_session()
l = sess.query(User).all()
@@ -975,9 +975,9 @@ class OptionsTest(_fixtures.FixtureTest):
mapper(User, users, properties=dict(
addresses=relation(Address, lazy=False,
- order_by=addresses.default_order_by()),
+ order_by=addresses.c.id),
orders=relation(Order, lazy=False,
- order_by=orders.default_order_by())))
+ order_by=orders.c.id)))
sess = create_session()
@@ -1021,14 +1021,14 @@ class DeepOptionsTest(_fixtures.FixtureTest):
mapper(Item, items, properties=dict(
keywords=relation(Keyword, item_keywords,
- order_by=item_keywords.default_order_by())))
+ order_by=item_keywords.c.item_id)))
mapper(Order, orders, properties=dict(
items=relation(Item, order_items,
- order_by=items.default_order_by())))
+ order_by=items.c.id)))
- mapper(User, users, order_by=users.default_order_by(), properties=dict(
- orders=relation(Order, order_by=orders.default_order_by())))
+ mapper(User, users, order_by=users.c.id, properties=dict(
+ orders=relation(Order, order_by=orders.c.id)))
@testing.resolve_artifact_names
def test_deep_options_1(self):
diff --git a/test/profiling/zoomark_orm.py b/test/profiling/zoomark_orm.py
index a8c1d5dce..39446dbf8 100644
--- a/test/profiling/zoomark_orm.py
+++ b/test/profiling/zoomark_orm.py
@@ -294,7 +294,7 @@ class ZooMarkTest(TestBase):
def test_profile_1a_populate(self):
self.test_baseline_1a_populate()
- @profiling.function_call_count(1254, {'2.4':1184})
+ @profiling.function_call_count(1185, {'2.4':1184})
def test_profile_2_insert(self):
self.test_baseline_2_insert()
diff --git a/test/sql/labels.py b/test/sql/labels.py
index 3e025e5e7..a0f49f3f1 100644
--- a/test/sql/labels.py
+++ b/test/sql/labels.py
@@ -137,16 +137,5 @@ class LongLabelsTest(TestBase, AssertsCompiledSQL):
print x.execute().fetchall()
- def test_oid(self):
- """test that a primary key column compiled as the 'oid' column gets proper length truncation"""
- from sqlalchemy.databases import postgres
- dialect = postgres.PGDialect()
- dialect.max_identifier_length = 30
- tt = table1.select(use_labels=True).alias('foo')
- x = select([tt], use_labels=True, order_by=tt.oid_column).compile(dialect=dialect)
- #print x
- # assert it doesnt end with "ORDER BY foo.some_large_named_table_this_is_the_primarykey_column"
- assert str(x).endswith("""ORDER BY foo.some_large_named_table_t_2""")
-
if __name__ == '__main__':
testenv.main()
diff --git a/test/sql/select.py b/test/sql/select.py
index a1414da71..52aa151d9 100644
--- a/test/sql/select.py
+++ b/test/sql/select.py
@@ -917,9 +917,6 @@ FROM myothertable UNION SELECT thirdtable.userid, thirdtable.otherstuff FROM thi
assert u1.corresponding_column(table2.c.otherid) is u1.c.myid
- assert u1.corresponding_column(table1.oid_column) is u1.oid_column
- assert u1.corresponding_column(table2.oid_column) is u1.oid_column
-
# TODO - why is there an extra space before the LIMIT ?
self.assert_compile(
union(
@@ -979,7 +976,6 @@ SELECT thirdtable.userid FROM thirdtable)"
UNION SELECT mytable.myid FROM mytable"
)
- # test unions working with non-oid selectables
s = select([column('foo'), column('bar')])
s = union(s, s)
s = union(s, s)
diff --git a/test/sql/selectable.py b/test/sql/selectable.py
index 61d078a51..e41165b5b 100755
--- a/test/sql/selectable.py
+++ b/test/sql/selectable.py
@@ -95,10 +95,8 @@ class SelectableTest(TestBase, AssertsExecutionResults):
def test_singular_union(self):
u = union(select([table.c.col1, table.c.col2, table.c.col3]), select([table.c.col1, table.c.col2, table.c.col3]))
- assert u.oid_column is not None
u = union(select([table.c.col1, table.c.col2, table.c.col3]))
- assert u.oid_column
assert u.c.col1
assert u.c.col2
assert u.c.col3
@@ -214,24 +212,6 @@ class SelectableTest(TestBase, AssertsExecutionResults):
assert j4.corresponding_column(j2.c.aid) is j4.c.aid
assert j4.corresponding_column(a.c.id) is j4.c.id
- @testing.emits_warning('.*replaced by another column with the same key')
- def test_oid(self):
- # the oid column of a selectable currently proxies all
- # oid columns found within.
- s = table.select()
- s2 = table2.select()
- s3 = select([s, s2])
- assert s3.corresponding_column(table.oid_column) is s3.oid_column
- assert s3.corresponding_column(table2.oid_column) is s3.oid_column
- assert s3.corresponding_column(s.oid_column) is s3.oid_column
- assert s3.corresponding_column(s2.oid_column) is s3.oid_column
-
- u = s.union(s2)
- assert u.corresponding_column(table.oid_column) is u.oid_column
- assert u.corresponding_column(table2.oid_column) is u.oid_column
- assert u.corresponding_column(s.oid_column) is u.oid_column
- assert u.corresponding_column(s2.oid_column) is u.oid_column
-
def test_two_metadata_join_raises(self):
m = MetaData()
m2 = MetaData()