Commit Graph

806 Commits

Author SHA1 Message Date
Mike Bayer 62b7a8133a - [bug] Fixed bug in over() construct whereby
passing an empty list for either partition_by
    or order_by, as opposed to None, would fail
    to generate correctly.
    Courtesy Gunnlaugur Por Briem.
    [ticket:2574]
2012-09-30 17:18:14 -04:00
Mike Bayer b9ea55f861 - more tests, move some tests out of test_reflection, test_query 2012-09-27 16:11:32 -04:00
Mike Bayer 20cdc64588 trying different approaches to test layout. in this one, the testing modules
become an externally usable package but still remains within the main sqlalchemy parent package.
in this system, we use kind of an ugly hack to get the noseplugin imported outside of the
"sqlalchemy" package, while still making it available within sqlalchemy for usage by
third party libraries.
2012-09-27 02:37:33 -04:00
Mike Bayer 1a7778632d - further reorganization of test suite:
- bootstrap and lib move to all absolute imports
  - testing.py is no longer internally referenced.
  - requirements move to be a pluggable class which can
    be overridden.
  - cleanup

in the interests of third party testing, test/lib and test/bootstrap
may move to be an independent package.
2012-09-26 17:21:21 -04:00
Mike Bayer c7c17e991c - [bug] Fixed the DropIndex construct to support
an Index associated with a Table in a remote
    schema. [ticket:2571]
2012-09-24 11:17:16 -04:00
Mike Bayer 444abbe847 - got firebird running
- add some failure cases
- [bug] Firebird now uses strict "ansi bind rules"
so that bound parameters don't render in the
columns clause of a statement - they render
literally instead.

- [bug] Support for passing datetime as date when
using the DateTime type with Firebird; other
dialects support this.
2012-09-23 18:09:18 -04:00
Mike Bayer 152163b333 - [bug] When the primary key column of a Table
is replaced, such as via extend_existing,
    the "auto increment" column used by insert()
    constructs is reset.  Previously it would
    remain referring to the previous primary
    key column.  [ticket:2525]
2012-09-23 12:51:24 -04:00
Mike Bayer e354dd10f8 - [feature] An explicit error is raised when
a ForeignKeyConstraint() that was
    constructed to refer to multiple remote tables
    is first used. [ticket:2455]
2012-09-23 12:42:38 -04:00
Mike Bayer 4da34b4cb7 - clean pyflakes 2012-09-23 12:31:41 -04:00
Mike Bayer 23d300c874 - [bug] A tweak to column precedence which moves the
"concat" and "match" operators to be the same as
    that of "is", "like", and others; this helps with
    parenthesization rendering when used in conjunction
    with "IS". [ticket:2564]
2012-09-22 16:48:49 -04:00
Mike Bayer 6c50ffcf44 - aaand actually get is/isnot to be usable with None/NULL 2012-09-22 16:45:02 -04:00
Mike Bayer 1ceda8c23c - [bug] Added missing operators is_(), isnot()
to the ColumnOperators base, so that these long-available
    operators are present as methods like all
    the other operators.  [ticket:2544]
2012-09-22 16:14:58 -04:00
Mike Bayer 7e815c67a9 finished fixes for mxodbc; need to use at least version 3.2.1 2012-09-21 17:43:22 -04:00
Mike Bayer cd8b9dcd37 - [feature] The cast() and extract() constructs
will now be produced via the func.* accessor
as well, as users naturally try to access these
names from func.* they might as well do
what's expected, even though the returned
object is not a FunctionElement.
[ticket:2562]
2012-09-10 12:58:11 -04:00
Mike Bayer 1c325dc9c7 - [feature] Added a hook to the system of rendering
CREATE TABLE that provides access to the render for each
Column individually, by constructing a @compiles
function against the new schema.CreateColumn
construct.  [ticket:2463]
2012-09-09 14:39:25 -04:00
Mike Bayer 78937f6aad add a contains() override test 2012-09-04 11:30:31 -04:00
Mike Bayer bc9ff8fcc9 lshift (<<) and rshift (>>) are also supported as optional operators. 2012-09-04 10:44:37 -04:00
Mike Bayer 82e874b64b - type expressions invoke in SQL, but are only for the benefit of columns
delivered to a result set. therefore these expressions should only be rendered
for those columns that are being delivered to the result, thereby preventing
the expression from stacking onto itself within nesting scenarios.
2012-09-03 10:28:26 -04:00
Mike Bayer 626ae5b7a1 - fixes for mxODBC, some pyodbc
- enhancements to test suite including ability to set up a testing engine
for a whole test class, fixes to how noseplugin sets up/tears
down per-class context
2012-09-02 15:14:09 -04:00
Mike Bayer 9070e5c2a5 - repair type expressions for columns when we aren't using select.apply_labels(),
label should be the column name.
2012-09-01 20:15:33 -04:00
Mike Bayer 51f1fdf3e4 - [bug] Fixed a regression since 0.6 regarding
result-row targeting.   It should be possible
    to use a select() statement with string
    based columns in it, that is
    select(['id', 'name']).select_from('mytable'),
    and have this statement be targetable by
    Column objects with those names; this is the
    mechanism by which
    query(MyClass).from_statement(some_statement)
    works.  At some point the specific case of
    using select(['id']), which is equivalent to
    select([literal_column('id')]), stopped working
    here, so this has been re-instated and of
    course tested. [ticket:2558]
2012-08-31 20:04:04 -04:00
Mike Bayer 19d0434626 skip this silly test entirely for PG 2012-08-31 11:04:59 -04:00
Mike Bayer f46f16d4c7 fixes to prevent the new MyISAM engine from breaking other tests 2012-08-29 12:16:18 -04:00
Mike Bayer 7d6c1c4a95 - [feature] Reworked the startswith(), endswith(),
contains() operators to do a better job with
    negation (NOT LIKE), and also to assemble them
    at compilation time so that their rendered SQL
    can be altered, such as in the case for Firebird
    STARTING WITH [ticket:2470]
  - [feature] firebird - The "startswith()" operator renders
    as "STARTING WITH", "~startswith()" renders
    as "NOT STARTING WITH", using FB's more efficient
    operator.  [ticket:2470]
2012-08-27 19:40:12 -04:00
Mike Bayer 326f2e4f60 - [feature] The "required" flag is set to
True by default, if not passed explicitly,
on bindparam() if the "value" or "callable"
parameters are not passed.
This will cause statement execution to check
for the parameter being present in the final
collection of bound parameters, rather than
implicitly assigning None. [ticket:2556]
2012-08-27 15:11:53 -04:00
Mike Bayer c7ceb00792 - add "identifier", can differentiate between "name" rendered and "identifier" in func. 2012-08-26 18:01:21 -04:00
Mike Bayer b0e0bbb816 - tweak the GenericFunction constructor more so that it's action in parsing the
arguments is easier to understand
- add a test to ensure generic function can have a custom name
2012-08-26 11:30:42 -04:00
Mike Bayer e4ff3d2a35 oracle fixes... 2012-08-25 14:19:47 -04:00
Mike Bayer 752750ea7e - fix for pypy
- more oracle fixes
2012-08-25 13:30:58 -04:00
Mike Bayer 2c2c6a3fe8 - correct the argument signature for GenericFunction to be more predictable 2012-08-24 16:14:47 -04:00
Mike Bayer 17f9bc5735 small tweaks to make insert() behavior more consistent, mostly tests, [ticket:2461] 2012-08-23 18:49:33 -04:00
Mike Bayer 28bfc3d5df - [feature] The before_cursor_execute event
fires off for so-called "_cursor_execute"
    events, which are usually special-case
   executions of primary-key bound sequences
    and default-generation SQL
    phrases that invoke separately when RETURNING
    is not used with INSERT.  [ticket:2459]
2012-08-23 15:40:09 -04:00
Mike Bayer 16d66d3564 - [bug] Fixed bug whereby usage of a UNION
or similar inside of an embedded subquery
would interfere with result-column targeting,
in the case that a result-column had the same
ultimate name as a name inside the embedded
UNION. [ticket:2552]
2012-08-22 18:55:59 -04:00
Mike Bayer 8f5a31441a - [bug] Fixed cextension bug whereby the
"ambiguous column error" would fail to
function properly if the given index were
a Column object and not a string.
Note there are still some column-targeting
issues here which are fixed in 0.8.
[ticket:2553]
- find more cases where column targeting is being inaccurate, add
more information to result_map to better differentiate "ambiguous"
results from "present" or "not present".  In particular, result_map
is sensitive to dupes, even though no error is raised; the conflicting
columns are added to the "obj" member of the tuple so that the two
are both directly accessible in the result proxy
- handwringing over the damn "name fallback" thing in results.  can't
really make it perfect yet
- fix up oracle returning clause.  not sure why its guarding against
labels, remove that for now and see what the bot says.
2012-08-22 18:41:46 -04:00
Mike Bayer 0e9ad80760 - [feature] Enhanced GenericFunction and func.*
to allow for user-defined GenericFunction
    subclasses to be available via the func.*
    namespace automatically by classname,
    optionally using a package name as well.
2012-08-22 13:54:13 -04:00
Mike Bayer ffab937e4c fixes for pg9 2012-08-22 03:37:10 -04:00
Mike Bayer aef0c7a903 - [feature] The Core oeprator system now includes
the `getitem` operator, i.e. the bracket
operator in Python.  This is used at first
to provide index and slice behavior to the
Postgresql ARRAY type, and also provides a hook
for end-user definition of custom __getitem__
schemes which can be applied at the type
level as well as within ORM-level custom
operator schemes.

Note that this change has the effect that
descriptor-based __getitem__ schemes used by
the ORM in conjunction with synonym() or other
"descriptor-wrapped" schemes will need
to start using a custom comparator in order
to maintain this behavior.

- [feature] postgresql.ARRAY now supports
indexing and slicing.  The Python [] operator
is available on all SQL expressions that are
of type ARRAY; integer or simple slices can be
passed.  The slices can also be used on the
assignment side in the SET clause of an UPDATE
statement by passing them into Update.values();
see the docs for examples.

- [feature] Added new "array literal" construct
postgresql.array().  Basically a "tuple" that
renders as ARRAY[1,2,3].
2012-08-20 17:04:25 -04:00
Mike Bayer ce1b80ad08 - [bug] Fixes to the interpretation of the
Column "default" parameter as a callable
to not pass ExecutionContext into a keyword
argument parameter.  [ticket:2520]
2012-08-20 13:20:09 -04:00
Mike Bayer 223af5b116 - [feature] The prefix_with() method is now available
on each of select(), insert(), update(), delete(),
    all with the same API, accepting multiple
    prefix calls, as well as a "dialect name" so that
    the prefix can be limited to one kind of dialect.
    [ticket:2431]
2012-08-19 21:15:40 -04:00
Mike Bayer 824bd66158 - aaaaand fix one more glitch I just thought of 2012-08-18 01:03:31 -04:00
Mike Bayer 515811eb58 - fix the labeled column with column_expression() issue, finishes [ticket:1534]
- epic documentation sweep for new operator system, making ORM links consistent
and complete, full documentation and examples for type/SQL expression feature
- type_coerce() explicitly accepts BindParamClause objects
- change UserDefinedType to coerce the other side to itself by default as this
is much more likely what's desired
- make coerce_compared_type() fully public on all types
- have profiling run the test no matter what so that the test_zoomarks don't fail
when callcounts are missing
2012-08-18 00:54:00 -04:00
Mike Bayer a2468c8a31 - [feature] To complement [ticket:2547], types
can now provide "bind expressions" and
"column expressions" which allow compile-time
injection of SQL expressions into statements
on a per-column or per-bind level.   This is
to suit the use case of a type which needs
to augment bind- and result- behavior at the
SQL level, as opposed to in the Python level.
Allows for schemes like transparent encryption/
decryption, usage of Postgis functions, etc.
[ticket:1534]
- update postgis example fully.
- still need to repair the result map propagation
here to be transparent for cases like "labeled column".
2012-08-17 18:35:25 -04:00
Mike Bayer f327eaea47 _adapt_expression() moves fully to _DefaultColumnComparator which resumes
its original role as stateful, forms the basis of TypeEngine.Comparator.  lots
of code goes back mostly as it was just with cleaner typing behavior, such
as simple flow in _binary_operate now.
2012-08-16 16:11:42 -04:00
Mike Bayer 079f5a282b -we move all the invocation of "_adapt_expression" into TypeEngine.Comparator. at this point
the split of operator stuff is getting awkward and we might want to move _DefaultComparator.
2012-08-16 14:07:33 -04:00
Mike Bayer 54808ecccd - [bug] Declarative can now propagate a column
declared on a single-table inheritance subclass
up to the parent class' table, when the parent
class is itself mapped to a join() or select()
statement, directly or via joined inheritane,
and not just a Table.   [ticket:2549]
2012-08-15 18:42:59 -04:00
Mike Bayer 05864ab8a6 - fix concat() operator, tests
- [feature] Custom unary operators can now be
  used by combining operators.custom_op() with
  UnaryExpression().
- clean up the operator dispatch system and make it more consistent.
This does change the compiler contract for custom ops.
2012-08-14 13:47:58 -04:00
Mike Bayer 2937f94e4a - all tests pass 2012-08-13 16:53:38 -04:00
Mike Bayer 37fad88b84 move the whole thing to TypeEngine. the feature is pretty much for free like this. 2012-08-13 16:18:12 -04:00
Mike Bayer d9b5991f9c - develop new system of applying custom operators to ColumnElement classes. resembles
that of the ORM so far.
2012-08-13 14:37:58 -04:00
Mike Bayer 7a81ecc82c - adjustments for py3.3 unit tests, [ticket:2542] 2012-08-11 21:46:48 -04:00