Commit Graph

736 Commits

Author SHA1 Message Date
Mike Bayer 87bbba32bc - [feature] The behavior of column targeting
in result sets is now case sensitive by
default.   SQLAlchemy for many years would
run a case-insensitive conversion on these values,
probably to alleviate early case sensitivity
issues with dialects like Oracle and
Firebird.   These issues have been more cleanly
solved in more modern versions so the performance
hit of calling lower() on identifiers is removed.
The case insensitive comparisons can be re-enabled
by setting "case_insensitive=False" on
create_engine().  [ticket:2423]
2012-04-24 16:03:00 -04:00
Mike Bayer 503bddc879 - [bug] column.label(None) now produces an
anonymous label, instead of returning the
column object itself, consistent with the behavior
of label(column, None).  [ticket:2168]
2012-04-24 13:04:38 -04:00
Mike Bayer 9b73e997b2 - [bug] The names of the columns on the
.c. attribute of a select().apply_labels()
is now based on <tablename>_<colkey> instead
of <tablename>_<colname>, for those columns
that have a distinctly named .key.
[ticket:2397]
2012-04-24 11:24:23 -04:00
Mike Bayer 713a4e19fa - merged #1401 branch from bitbucket
- resolved some serious speed hits I missed, we need to ensure
only deannotated columns are used in the local/remote collections and soforth
so that hash lookups against mapped columns don't dig into __eq__()
- fix some other parity mismatches regarding stuff from [ticket:2453],
including finding another case where _deep_annotate() was doing the wrong thing,
new tests.
- [feature] Major rewrite of relationship()
internals now allow join conditions which
include columns pointing to themselves
within composite foreign keys.   A new
API for very specialized primaryjoin conditions
is added, allowing conditions based on
SQL functions, CAST, etc. to be handled
by placing the annotation functions
remote() and foreign() inline within the
expression when necessary.  Previous recipes
using the semi-private _local_remote_pairs
approach can be upgraded to this new
approach. [ticket:1401]
2012-04-22 19:43:31 -04:00
Mike Bayer 541e59c3d7 - [bug] UPDATE..FROM syntax with SQL Server
requires that the updated table be present
in the FROM clause when an alias of that
table is also present in the FROM clause.
The updated table is now always present
in the FROM, when FROM is present
in the first place.  Courtesy sayap.
[ticket:2468]
2012-04-18 19:52:58 -04:00
Mike Bayer 1378bf0d25 - reopened #2453, needed to put in the original patch as well to cover the case
of column_property() objs building off each other
2012-04-03 09:59:22 -04:00
Mike Bayer 47a799ecd5 - sql
- [bug] Removed warning when Index is created
    with no columns; while this might not be what
    the user intended, it is a valid use case
    as an Index could be a placeholder for just an
    index of a certain name.

- mssql
  - [feature] Added interim create_engine flag
    supports_unicode_binds to PyODBC dialect,
    to force whether or not the dialect
    passes Python unicode literals to PyODBC
    or not.
2012-04-01 19:42:54 -04:00
Mike Bayer 45046367f3 - [bug] Fixed bug in expression annotation
mechanics which could lead to incorrect
rendering of SELECT statements with aliases
and joins, particularly when using
column_property().  [ticket:2453]
2012-03-31 13:35:05 -04:00
Mike Bayer 7142a17291 - [feature] Added new for_update/with_lockmode()
options for Postgresql: for_update="read"/
with_lockmode("read"),
for_update="read_nowait"/
with_lockmode("read_nowait").
These emit "FOR SHARE" and "FOR SHARE NOWAIT",
respectively.  Courtesy Diana Clarke
[ticket:2445]
2012-03-21 22:58:55 -04:00
Mike Bayer 3bf8feb6dd fails on oracle too 2012-03-14 16:41:20 -07:00
Mike Bayer 042184fdc9 add a checkfirst here as s3 seems to be stuck on the jenkins db 2012-03-14 16:25:57 -07:00
Mike Bayer d62a2ca58f pg8000 fails on this 2012-03-14 14:56:57 -07:00
Mike Bayer 7ad0c8cb2b - [bug] Fixed issue whereby attribute-based
column access on a row would raise
AttributeError with non-C version,
NoSuchColumnError with C version.  Now
raises AttributeError in both cases.
[ticket:2398]
2012-03-14 14:34:36 -07:00
Mike Bayer a774deb9a4 hey pyodbc fixed this, hoopde doo 2012-03-13 22:37:25 -07:00
Mike Bayer bf57355fee - [bug] Fixed bug in C extensions whereby
string format would not be applied to a
Numeric value returned as integer; this
affected primarily SQLite which does
not maintain numeric scale settings.
[ticket:2432]
2012-03-13 20:38:30 -07:00
Mike Bayer 57868f587e - [bug] Fixed bug whereby a primaryjoin
condition with a "literal" in it would
raise an error on compile with certain
kinds of deeply nested expressions
which also needed to render the same
bound parameter name more than once.
[ticket:2425]
2012-03-12 13:35:27 -07:00
Mike Bayer 1607b74f85 - [feature] Added cte() method to Query,
invokes common table expression support
from the Core (see below). [ticket:1859]

- [feature] Added support for SQL standard
common table expressions (CTE), allowing
SELECT objects as the CTE source (DML
not yet supported).  This is invoked via
the cte() method on any select() construct.
[ticket:1859]
2012-03-03 13:00:44 -05:00
Mike Bayer 0536c48daf - expand the check to determine if a selectable column is embedded
in the corresponding selectable to take into account clones
of the target column.  fixes [ticket:2419]
- have _make_proxy() copy out the _is_clone_of attribute on the
new column so that even more corresponding_column() checks
work as expected for cloned elements.
- add a new test fixture so that mapped tests can be specified
using declarative.
2012-02-29 17:47:59 -05:00
Mike Bayer abe6c0f08a - [bug] A warning is emitted when a not-present
column is stated in the values() clause
of an insert() or update() construct.
Will move to an exception in 0.8.
[ticket:2413]
2012-02-21 10:49:38 -05:00
Mike Bayer 04c7bae308 - test failures. one in particular seems to be a weird oursql bug, oh well 2012-02-12 20:00:44 -05:00
Mike Bayer d50ea3eabf - [bug] Index will raise when arguments passed
cannot be interpreted as columns or expressions.
Will warn when Index is created
with no columns at all.  [ticket:2380]
2012-02-12 17:47:36 -05:00
Mike Bayer d934ea23e2 - figured out again why deannotate must clone()
- got everything working.  just need to update
error strings
2012-02-11 20:33:56 -05:00
Mike Bayer 7d693180be tweak for correlated subqueries here, seems to work for test_eager_relations:CorrelatedSubqueryTest but need some more testing here 2012-02-10 17:59:06 -05:00
Mike Bayer bc45fa350a - got m2m, local_remote_pairs, etc. working
- using new traversal that returns the product of both sides
of a binary, starting to work with (a+b) == (c+d) types of joins.
primaryjoins on functions working
- annotations working, including reversing local/remote when
doing backref
2012-02-09 21:16:53 -05:00
Mike Bayer 73f734bf80 initial annotations approach to join conditions. all tests pass, plus additional tests in #1401 pass.
would now like to reorganize RelationshipProperty more around the annotations concept.
2012-02-06 12:20:15 -05:00
Mike Bayer 2dbeeff50b - [bug] Added support for using the .key
of a Column as a string identifier in a
result set row.   The .key is currently
listed as an "alternate" name for a column,
and is superseded by the name of a column
which has that key value as its regular name.
For the next major release
of SQLAlchemy we may reverse this precedence
so that .key takes precedence, but this
is not decided on yet.  [ticket:2392]
2012-02-05 16:58:32 -05:00
Mike Bayer a4e3bc61bc - [bug] A significant change to how labeling
is applied to columns in SELECT statements
allows "truncated" labels, that is label names
that are generated in Python which exceed
the maximum identifier length (note this is
configurable via label_length on create_engine()),
to be properly referenced when rendered inside
of a subquery, as well as to be present
in a result set row using their original
in-Python names.   [ticket:2396]

- apply pep8 to test_labels
2012-02-05 14:22:55 -05:00
Mike Bayer dbd46170fb mark this test as unsupported before 2.6, there's some unicode
issue I'm not exactly sure of what nature it is
2012-01-28 16:00:34 -05:00
Mike Bayer 96dce7686c - [feature] New reflection feature "autoload_replace";
when set to False on Table, the Table can be autoloaded
without existing columns being replaced.  Allows
more flexible chains of Table construction/reflection
to be constructed, including that it helps with
combining Declarative with table reflection.
See the new example on the wiki.  [ticket:2356]

- [bug] Improved the API for add_column() such that
if the same column is added to its own table,
an error is not raised and the constraints
don't get doubled up.  Also helps with some
reflection/declarative patterns. [ticket:2356]
2012-01-28 15:54:28 -05:00
Mike Bayer 09553dc90f - [feature] Dialect-specific compilers now raise
CompileException for all type/statement compilation
issues, instead of InvalidRequestError or ArgumentError.
The DDL for CREATE TABLE will re-raise
CompileExceptions to include table/column information
for the problematic column.  [ticket:2361]
2012-01-28 15:20:21 -05:00
Mike Bayer c6e07f6a59 - [bug] Fixed issue where the "required" exception
would not be raised for bindparam() with required=True,
if the statement were given no parameters at all.
[ticket:2381]
2012-01-28 14:20:25 -05:00
Mike Bayer 37773f3448 - adjust the test for [ticket:2377] to be less controversial on
problematic backends like Oracle.i
- move the check generated in r85017c4310d2 up for both label name/name
comparisions, fixes additional mismatches which can occur
2012-01-22 17:40:50 -05:00
Mike Bayer bd87e2c455 pg8000 fix 2012-01-22 15:20:36 -05:00
Mike Bayer 09a503e497 - [bug] Fixed bug whereby a table-bound Column
object named "<a>_<b>" which matched a column
labeled as "<tablename>_<colname>" could match
inappropriately when targeting in a result
set row.  [ticket:2377]
- requires that we change the tuple format in RowProxy.
Makes an improvement to the cases tested against
an unpickled RowProxy as well though doesn't solve the
problem there entirely.
2012-01-22 14:04:20 -05:00
Mike Bayer 45e3b4d0c5 add test for #2193 2011-12-27 17:03:53 -05:00
Mike Bayer 6ed0d7e333 add a conditional here 2011-12-15 11:42:50 -05:00
Mike Bayer c718ad227e tests for FK/autoincrement selection 2011-12-06 22:00:35 -05:00
Mike Bayer 133a0b2460 - [bug] the "name" of a column-level CHECK constraint,
if present, is now rendered in the CREATE TABLE
statement using "CONSTRAINT <name> CHECK <expression>".
[ticket:2305]
2011-12-04 13:46:45 -05:00
Mike Bayer 699146086d - [bug] Fixed bug whereby column_property() created
against ORM-level column could be treated as
a distinct entity when producing certain
kinds of joined-inh joins.  [ticket:2316]

- [bug] related to [ticket:2316], made some
adjustments to the change from [ticket:2261]
regarding the "from" list on a select(). The
_froms collection is no longer memoized, as this
simplifies various use cases and removes the
need for a "warning" if a column is attached
to a table after it was already used in an
expression - the select() construct will now
always produce the correct expression.
There's probably no real-world
performance hit here; select() objects are
almost always made ad-hoc, and systems that
wish to optimize the re-use of a select()
would be using the "compiled_cache" feature.
A hit which would occur when calling select.bind
has been reduced, but the vast majority
of users shouldn't be using "bound metadata"
anyway :).
2011-12-03 19:50:01 -05:00
Mike Bayer beef2b5aa8 - [bug] Fixed bug whereby TypeDecorator would
return a stale value for _type_affinity, when
using a TypeDecorator that "switches" types,
like the CHAR/UUID type.
2011-11-28 12:44:56 -05:00
Mike Bayer 9c896906c7 also add support for onupdate as we'd like this to fire off if an UPDATE actually
happens on the table
2011-11-22 18:46:45 -05:00
Mike Bayer 4de3b28abc fixes to actually get tests to pass 2011-11-22 18:05:05 -05:00
Mike Bayer 90b6ca30e4 - commit the unit tests
- lots of doc updates to all three of update/insert/delete
2011-11-22 17:27:35 -05:00
Mike Bayer 0c3a53d433 sort of muscling this out, mysql a PITA 2011-11-21 20:40:31 -05:00
Mike Bayer c0c42af4e0 - [bug] further tweak to the fix from [ticket:2261],
so that generative methods work a bit better
off of cloned (this is almost a non-use case though).
In particular this allows with_only_columns()
to behave more consistently.   Added additional
documentation to with_only_columns() to clarify
expected behavior, which changed as a result
of [ticket:2261].  [ticket:2319]
- document the crap out of with_only_columns, include caveats about
the change, etc.
2011-11-19 23:28:01 -05:00
Mike Bayer b746921e78 - [bug] Unicode adjustments allow latest pymysql
(post 0.4) to pass 100% on Python 2.
2011-11-02 12:34:55 -04:00
Mike Bayer e6a5ea8fa7 - [bug] Postgresql dialect memoizes that an ENUM of a
particular name was processed
during a create/drop sequence.  This allows
a create/drop sequence to work without any
calls to "checkfirst", and also means with
"checkfirst" turned on it only needs to
check for the ENUM once.  [ticket:2311]
2011-10-29 17:38:56 -04:00
Mike Bayer 8301651428 - [feature] Added new support for remote "schemas":
- MetaData() accepts "schema" and "quote_schema"
      arguments, which will be applied to the same-named
      arguments of a Table
      or Sequence which leaves these at their default
      of ``None``.
    - Sequence accepts "quote_schema" argument
    - tometadata() for Table will use the "schema"
      of the incoming MetaData for the new Table
      if the schema argument is explicitly "None"
    - Added CreateSchema and DropSchema DDL
      constructs - these accept just the string
      name of a schema and a "quote" flag.
    - When using default "schema" with MetaData,
      ForeignKey will also assume the "default" schema
      when locating remote table.  This allows the "schema"
      argument on MetaData to be applied to any
      set of Table objects that otherwise don't have
      a "schema".
    - a "has_schema" method has been implemented
      on dialect, but only works on Postgresql so far.
    Courtesy Manlio Perillo, [ticket:1679]
2011-10-23 16:57:48 -04:00
Mike Bayer a708d0fbce - Added accessor to types called "python_type",
returns the rudimentary Python type object
for a particular TypeEngine instance, if known,
else raises NotImplementedError.  [ticket:77]
2011-10-23 13:05:56 -04:00
Mike Bayer 88cb44ceee some mssql stuff, though unicode is really not working still... 2011-10-16 11:34:48 -04:00