summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/schema.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-01-28 23:33:53 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-01-28 23:33:53 +0000
commitbbc5e7c285a160f148eafa0ab442675fe88551ce (patch)
tree71f407e9de4c29ac427d01acc7730ac3dd714a80 /lib/sqlalchemy/schema.py
parent7a1a746d7abaebb1e1712224a8ebbf037cc94435 (diff)
downloadsqlalchemy-bbc5e7c285a160f148eafa0ab442675fe88551ce.tar.gz
merged the polymorphic relationship refactoring branch in. i want to go further on that branch and introduce the foreign_keys argument, and further centralize the "intelligence" about the joins and selectables into PropertyLoader so that lazyloader/sync can be simplified, but the current branch goes pretty far.
- relations keep track of "polymorphic_primaryjoin", "polymorphic_secondaryjoin" which it derives from the plain primaryjoin/secondaryjoin. - lazy/eagerloaders work from those polymorphic join objects. - the join exported by PropertyLoader to Query/SelectResults is the polymorphic join, so that join_to/etc work properly. - Query builds itself against the base Mapper again, not the "polymorphic" mapper. uses the "polymorphic" version only as appropriate. this helps join_by/join_to/etc to work with polymorphic mappers. - Query will also adapt incoming WHERE criterion to the polymorphic mapper, i.e. the "people" table becomes the "person_join" automatically. - quoting has been modified since labels made out of non-case-sensitive columns could themselves require quoting..so case_sensitive defaults to True if not otherwise specified (used to be based on the identifier itself). - the test harness gets an ORMTest base class and a bunch of the ORM unit tests are using it now, decreases a lot of redundancy.
Diffstat (limited to 'lib/sqlalchemy/schema.py')
-rw-r--r--lib/sqlalchemy/schema.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/sqlalchemy/schema.py b/lib/sqlalchemy/schema.py
index 8b36ba026..2be808ba6 100644
--- a/lib/sqlalchemy/schema.py
+++ b/lib/sqlalchemy/schema.py
@@ -65,8 +65,7 @@ class SchemaItem(object):
a local non-None value overrides all others. after that, the parent item
(i.e. Column for a Sequence, Table for a Column, MetaData for a Table) is
searched for a non-None setting, traversing each parent until none are found.
- finally, case_sensitive is set to True if and only if the name of this item
- is not all lowercase.
+ finally, case_sensitive is set to True as a default.
"""
local = getattr(self, '_%s_setting' % keyname, None)
if local is not None:
@@ -78,7 +77,7 @@ class SchemaItem(object):
parentval = getattr(parent, '_case_sensitive_setting', None)
if parentval is not None:
return parentval
- return name is not None and name.lower() != name
+ return True
def _get_case_sensitive(self):
try:
return self.__case_sensitive
@@ -194,11 +193,9 @@ class Table(SchemaItem, sql.TableClause):
quote_schema=False : indicates that the Namespace identifier must be properly escaped and quoted before being sent
to the database. This flag overrides all other quoting behavior.
- case_sensitive=True : indicates that the identifier should be interpreted by the database in the natural case for identifiers.
- Mixed case is not sufficient to cause this identifier to be quoted; it must contain an illegal character.
+ case_sensitive=True : indicates quoting should be used if the identifier needs it.
- case_sensitive_schema=True : indicates that the identifier should be interpreted by the database in the natural case for identifiers.
- Mixed case is not sufficient to cause this identifier to be quoted; it must contain an illegal character.
+ case_sensitive_schema=True : indicates quoting should be used if the identifier needs it.
"""
super(Table, self).__init__(name)
self._metadata = metadata
@@ -365,8 +362,7 @@ class Column(SchemaItem, sql._ColumnClause):
to the database. This flag should normally not be required as dialects can auto-detect conditions where quoting
is required.
- case_sensitive=True : indicates that the identifier should be interpreted by the database in the natural case for identifiers.
- Mixed case is not sufficient to cause this identifier to be quoted; it must contain an illegal character.
+ case_sensitive=True : indicates quoting should be used if the identifier needs it.
"""
name = str(name) # in case of incoming unicode
super(Column, self).__init__(name, None, type)