Commit Graph

827 Commits

Author SHA1 Message Date
Diana Clarke 1ea0a71c60 first pass cleaning up test_labels #2610 2012-11-21 22:36:46 -05:00
Diana Clarke 0587a7ecdd this test class had 2 'test_labels' methods, just changing one of them to 'test_labels3' for now 2012-11-21 20:57:49 -05:00
Mike Bayer 1e29a74bd6 Fixed a gotcha where inadvertently calling list() on a
:class:`.ColumnElement` would go into an endless loop, if
      :meth:`.ColumnOperators.__getitem__` were implemented.
      A new NotImplementedError is emitted via ``__iter__()``.
2012-11-18 10:38:02 -05:00
Mike Bayer 94f8a792aa fix this test 2012-11-14 21:47:41 -05:00
Mike Bayer 27db59b337 Fixed bug whereby using "key" with Column
in conjunction with "schema" for the owning
Table would fail to locate result rows due
to the MSSQL dialect's "schema rendering"
logic's failure to take .key into account.
Also in 0.7.10. [ticket:2607]
2012-11-13 23:43:31 -05:00
Mike Bayer 6397a4ff4b Fixed bug in type_coerce() whereby typing information
could be lost if the statement were used as a subquery
inside of another statement, as well as other similar
situations.  Among other things, would cause
typing information to be lost when the Oracle/mssql dialects
would apply limit/offset wrappings. [ticket:2603]
2012-11-12 15:48:40 -05:00
Mike Bayer 12df8a9901 - support "fails_if" requirements as __requires__; so far this just skips, doesn't
actually run the test
- add requirements for date/datetime/time capabilities
- remove test/sql/test_types->DateTest and create new tests in suite/test_types
- move the StringTest with the "no length create" test to the suite, though this is a
weird test
2012-11-12 14:30:18 -05:00
Mike Bayer d30ab8495c Fixed bug whereby the ".key" of a Column wasn't being
used when producing a "proxy" of the column against
a selectable.   This probably didn't occur in 0.7
since 0.7 doesn't respect the ".key" in a wider
range of scenarios. [ticket:2597]
2012-10-31 14:30:47 -04:00
Mike Bayer a13812606c - remove remote_foreign annotation
- support annotations on Column where name isn't immediately present
2012-10-28 18:23:57 -04:00
Mike Bayer d0651ef4b3 Added :meth:.ColumnOperators.notin_,
:meth:`.ColumnOperators.notlike`,
:meth:`.ColumnOperators.notilike` to :class:`.ColumnOperators`.
[ticket:2580]
2012-10-24 16:01:17 -04:00
Mike Bayer 07d7c4905d Fixed bug where keyword arguments passed to
:meth:`.Compiler.process` wouldn't get propagated
to the column expressions present in the columns
clause of a SELECT statement.  In particular this would
come up when used by custom compilation schemes that
relied upon special flags. [ticket:2593]
2012-10-24 15:37:06 -04:00
Mike Bayer e656bf4f47 - move most/all operator specific tests into test_operator, convert fully to TOT 2012-10-24 14:29:52 -04:00
Mike Bayer c859893cb8 - get 100% lint/pep8 happening for test_compiler; next we will begin
cutting up tests and removing old ones
- move test_in() to test_operators
- slice up migrated operator tests into TOT
2012-10-24 14:02:37 -04:00
Mike Bayer 0c9d55db73 The auto-correlation feature of :func:.select, and
by proxy that of :class:`.orm.Query`, will not
      take effect for a SELECT statement that is being
      rendered directly in the FROM list of the enclosing
      SELECT.  Correlation in SQL only applies to column
      expressions such as those in the WHERE, ORDER BY,
      columns clause. [ticket:2595]
2012-10-22 13:29:12 -04:00
Mike Bayer ba67f7dbc5 - [bug] TypeDecorator now includes a generic repr()
that works in terms of the "impl" type by default.
    This is a behavioral change for those TypeDecorator
    classes that specify a custom __init__ method; those
    types will need to re-define __repr__() if they need
    __repr__() to provide a faithful constructor representation.
    [ticket:2594]
2012-10-18 12:29:41 -04:00
Mike Bayer 2484ef34c2 - [feature] The Query can now load entity/scalar-mixed
"tuple" rows that contain
    types which aren't hashable, by setting the flag
    "hashable=False" on the corresponding TypeEngine object
    in use.  Custom types that return unhashable types
    (typically lists) can set this flag to False.
    [ticket:2592]
  - [bug] Applying a column expression to a select
    statement using a label with or without other
    modifying constructs will no longer "target" that
    expression to the underlying Column; this affects
    ORM operations that rely upon Column targeting
    in order to retrieve results.  That is, a query
    like query(User.id, User.id.label('foo')) will now
    track the value of each "User.id" expression separately
    instead of munging them together.  It is not expected
    that any users will be impacted by this; however,
    a usage that uses select() in conjunction with
    query.from_statement() and attempts to load fully
    composed ORM entities may not function as expected
    if the select() named Column objects with arbitrary
    .label() names, as these will no longer target to
    the Column objects mapped by that entity.
    [ticket:2591]
2012-10-15 20:07:13 -04:00
Mike Bayer c307df6596 - [feature] "scalar" selects now have a WHERE method
to help with generative building.  Also slight adjustment
    regarding how SS "correlates" columns; the new methodology
    no longer applies meaning to the underlying
    Table column being selected.  This improves
    some fairly esoteric situations, and the logic
    that was there didn't seem to have any purpose.
  - [feature] Some support for auto-rendering of a
    relationship join condition based on the mapped
    attribute, with usage of core SQL constructs.
    E.g. select([SomeClass]).where(SomeClass.somerelationship)
    would render SELECT from "someclass" and use the
    primaryjoin of "somerelationship" as the WHERE
    clause.   This changes the previous meaning
    of "SomeClass.somerelationship" when used in a
    core SQL context; previously, it would "resolve"
    to the parent selectable, which wasn't generally
    useful.  Related to [ticket:2245].
2012-10-15 17:21:38 -04:00
Mike Bayer 06af57b05f - keep dialect at default for type compile
- python2.5/3 fixes
2012-10-11 11:15:29 -04:00
Mike Bayer d2410df9ca - create new sqlalchemy.testing.suite.test_types, starting with Unicode round trip tests.
- clean out existing test_types:UnicodeTest to be strictly individual unit tests
against Unicode(), String(), etc. with no database access.
2012-10-10 20:12:25 -04:00
Mike Bayer 084b559b44 - [feature] Added "collation" parameter to all
String types.  When present, renders as
    COLLATE <collation>.  This to support the
    COLLATE keyword now supported by several
    databases including MySQL, SQLite, and Postgresql.
    [ticket:2276]

  - [change] The Text() type renders the length
    given to it, if a length was specified.
2012-10-10 19:34:29 -04:00
Mike Bayer ef7c2f359d - don't call get_lastrowid() on explicit returning
- don't hardwire "subqueries" requirement in the base, mysql < 4.1 isn't working anyway
- don't need explicit FB/PG exclusions in test_returning
- hit db.connect() for the returning requirement
2012-10-04 17:36:02 -04:00
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