Commit Graph

727 Commits

Author SHA1 Message Date
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 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
Mike Bayer a0cc36c239 - adjust some tests and such to work better with a mysql 5.5 install
- Added mysql_length parameter to Index construct,
    specifies "length" for indexes.  [ticket:2293]
2011-10-11 00:15:43 -04:00
Mike Bayer 3104da4139 fix test 2011-09-24 12:13:45 -04:00
Mike Bayer e4c04590a6 - Modified Column.copy() to use _constructor(),
which defaults to self.__class__, in order to
    create the new object.  This allows easier support
    of subclassing Column.  [ticket:2284]
2011-09-23 20:51:58 -04:00
Mike Bayer 9d775a4cd4 - Fixed bug whereby with_only_columns() method of
Select would fail if a selectable were passed.
    [ticket:2270].  Also in 0.6.9.
2011-09-21 17:08:08 -04:00
Mike Bayer 1cf80dc5b2 - Changed the update() method on association proxy
dictionary to use a duck typing approach, i.e.
    checks for "keys", to discern between update({})
    and update((a, b)).   Previously, passing a
    dictionary that had tuples as keys would be misinterpreted
    as a sequence. [ticket:2275]
2011-09-14 11:31:33 -04:00
Mike Bayer 840aab3bea - Behavioral improvement: empty
conjunctions such as and_() and or_() will be
    flattened in the context of an enclosing conjunction,
    i.e. and_(x, or_()) will produce 'X' and not 'X AND
    ()'. [ticket:2257].
2011-09-09 16:03:23 -04:00
Mike Bayer 8c0e82238c - Fixed bug regarding calculation of "from" list
for a select() element.  The "from" calc is now
delayed, so that if the construct uses a Column
object that is not yet attached to a Table,
but is later associated with a Table, it generates
SQL using the table as a FROM.   This change
impacted fairly deeply the mechanics of how
the FROM list as well as the "correlates" collection
is calculated, as some "clause adaption" schemes
(these are used very heavily in the ORM)
were relying upon the fact that the "froms"
collection would typically be cached before the
adaption completed.   The rework allows it
such that the "froms" collection can be cleared
and re-generated at any time.  [ticket:2261]
- RelationshipProperty.Comparator._criterion_exists()
adds an "_orm_adapt" annotation to the correlates target,
to work with the change in [ticket:2261].   It's not clear
if the change to correlation+adaption mechanics will affect end user
code yet.
- FromClause now uses group_expirable_memoized_property for
late-generated values like primary key, _columns, etc.
The Select class adds some tokens to this object and has the
nice effect that FromClause doesn't need to know about
Select's names anymore.   An additional change might be to
have Select use a different group_expirable_memoized_property
so that it's collection of attribute names are specific to
Select though this isn't really necessary right now.
2011-09-05 19:12:12 -04:00
Mike Bayer 76a9219a1e - Added a slightly nicer __repr__() to SchemaItem
classes.  Note the repr here can't fully support
the "repr is the constructor" idea since schema
items can be very deeply nested/cyclical, have
late initialization of some things, etc.
[ticket:2223]
2011-08-14 12:20:54 -04:00
Mike Bayer 5751eb17f1 - Query will convert an OFFSET of zero when
slicing into None, so that needless OFFSET
clauses are not invoked.
- mssql: "0" is accepted as an argument for limit() which
will produce "TOP 0". [ticket:2222]
- add tests to default compiler test for LIMIT/OFFSET generation
2011-08-06 15:03:33 -04:00