Commit Graph

499 Commits

Author SHA1 Message Date
Mike Bayer 850e881ce2 More adjustment to this SQLite related issue which was released in
0.7.9, to intercept legacy SQLite quoting characters when reflecting
foreign keys.  In addition to intercepting double quotes, other
quoting characters such as brackets, backticks, and single quotes
are now also intercepted. [ticket:2568]
2012-12-14 10:29:46 -05:00
Mike Bayer d9d6dcea77 add future 2012-12-11 10:34:33 -05:00
Mike Bayer 70d38af42e Fixed table reflection for Oracle when accessing a synonym that refers
to a DBLINK remote database; while the syntax has been present in the
Oracle dialect for some time, up until now it has never been tested.
The syntax has been tested against a sample database linking to itself,
however there's still some uncertainty as to what should be used for the
"owner" when querying the remote database for table information.
Currently, the value of "username" from user_db_links is used to
match the "owner".  [ticket:2619]
2012-12-09 18:28:08 -05:00
Mike Bayer 927b985983 - multivalued inserts, [ticket:2623]
- update "not supported" messages for empty inserts, mutlivalue inserts

- rework the ValuesBase approach for multiple value sets so that stmt.parameters
does store a list for multiple values; the _has_multiple_parameters flag now indicates
which of the two modes the statement is within.  it now raises exceptions if a subsequent
call to values() attempts to call a ValuesBase with one mode in the style of the other
mode; that is, you can't switch a single- or multi- valued ValuesBase to the other mode,
and also if a multiple value is passed simultaneously with a kwargs set.
Added tests for these error conditions

- Calling values() multiple times in multivalue mode now extends the parameter list to
include the new parameter sets.

- add error/test if multiple *args were passed to ValuesBase.values()

- rework the compiler approach for multivalue inserts, back to where
_get_colparams() returns the same list of (column, value) as before, thereby
maintaining the identical number of append() and other calls when multivalue
is not enabled.  In the case of multivalue, it makes a last-minute switch to return
a list of lists instead of the single list.  As it constructs the additional lists, the inline
defaults and other calculated default parameters of the first parameter
set are copied into the newly generated lists so that these features continue
to function for a multivalue insert.   Multivalue inserts now add no additional
function calls to the compilation for regular insert constructs.

- parameter lists for multivalue inserts now includes an integer index for all
parameter sets.

- add detailed documentation for ValuesBase.values(), including careful wording
to describe the difference between multiple values and an executemany() call.

- add a test for multivalue insert + returning - it works !

- remove the very old/never used "postgresql_returning"/"firebird_returning" flags.
2012-12-08 14:25:42 -05:00
Mike Bayer 9d817406e2 The Oracle LONG type, while an unbounded text type, does not appear
to use the cx_Oracle.LOB type when result rows are returned,
so the dialect has been repaired to exclude LONG from
having cx_Oracle.LOB filtering applied.  Also in 0.7.10.
[ticket:2620]
2012-12-06 19:30:49 -05:00
Mike Bayer af1a545bdd Repaired the usage of `.prepare()` in conjunction with
cx_Oracle so that a return value of ``False`` will result
in no call to ``connection.commit()``, hence avoiding
"no transaction" errors.   Two-phase transactions have
now been shown to work in a rudimental fashion with
SQLAlchemy and cx_oracle, however are subject to caveats
observed with the driver; check the documentation
for details.  Also in 0.7.10.
[ticket:2611]
2012-12-06 19:10:06 -05:00
Audrius Kažukauskas 64505dcd28 HSTORE.comparator_factory should subclass Concatenable.Comparator 2012-11-21 00:26:20 +02:00
Audrius Kažukauskas 8134f2d0bf Add special containment operation methods for PG array type 2012-11-20 23:24:34 +02:00
Mike Bayer d1adef463a another hide from 2to3 test 2012-11-18 13:34:25 -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 cda08307be - hstore documentation, migration
- don't need a custom exception here, just use ValueError
2012-11-17 22:58:23 -05:00
Mike Bayer 4356741c48 - hstore adjustments 2012-11-17 20:45:17 -05:00
Audrius Kažukauskas 812b1d8614 Add PostgreSQL HStore type support 2012-11-13 16:43:41 +02: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 017989ce8b - move out maxdb
- begin consolidating docs for dialects to be more self contained
- add a separate section for "external" dialects
- not sure how we're going to go with this yet.
2012-10-18 18:24:15 -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 ce2c450917 - [feature] Added TIME type to mysql dialect,
accepts "fst" argument which is the new
    "fractional seconds" specifier for recent
    MySQL versions.  The datatype will interpret
    a microseconds portion received from the driver,
    however note that at this time most/all MySQL
    DBAPIs do not support returning this value.
    [ticket:2534]
- attempted to modernize the types tests in test_mysql a little, though has a long
way to go
2012-10-10 14:25:21 -04:00
Mike Bayer fab9be5d0e - [feature] the MS Access dialect has been
moved to its own project on Bitbucket,
    taking advantage of the new SQLAlchemy
    dialect compliance suite.   The dialect is
    still in very rough shape and probably not
    ready for general use yet, however
    it does have *extremely* rudimental
    functionality now.
2012-09-30 20:17:49 -04:00
Mike Bayer e35a6b91d6 - [bug] Fixed compiler bug whereby using a correlated
subquery within an ORDER BY would fail to render correctly
    if the stament also used LIMIT/OFFSET, due to mis-rendering
    within the ROW_NUMBER() OVER clause.  Fix courtesy
    sayap [ticket:2538]
2012-09-30 16:57:23 -04:00
Mike Bayer bba1d01b26 - [bug] The CreateIndex construct in Oracle
will now schema-qualify the name of the index
    to be that of the parent table.  Previously this
    name was omitted which apparently creates the
    index in the default schema, rather than that
    of the table.
2012-09-30 20:00:46 +00:00
Mike Bayer c0bba14268 - tighten mysql date test to not fail over 1 second boundaries (and probably microsecond boundaries once they support that...) 2012-09-30 11:00:00 -04:00
Mike Bayer bd48c8a9ec pg and oracle fixes 2012-09-30 01:02:56 -04:00
Mike Bayer 00e29c4cc6 - enhance setup.py to support being run from outside the current directory. hopefully there's no
gotchas with this on other platforms.
2012-09-29 13:08:07 -04:00
Mike Bayer be40b51cb0 getting everything to pass again 2012-09-27 16:33:54 -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 0c7b989ce5 - [feature] Added support for the localtimestamp()
SQL function implemented in SQLite, courtesy
Richard Mitchell.  Added test
2012-09-26 10:20:56 -04:00
Mike Bayer e1d09859c5 - [bug] Columns in reflected primary key constraint
are now returned in the order in which the constraint
    itself defines them, rather than how the table
    orders them.  Courtesy Gunnlaugur Por Briem.
    [ticket:2531].
2012-09-23 13:42:24 -04:00
Mike Bayer c7ab095fdb - [bug] Adjusted column default reflection code to
convert non-string values to string, to accommodate
old SQLite versions that don't deliver
default info as a string.  [ticket:2265]
- factor sqlite column reflection to be like we did for postgresql,
in a separate method.
2012-09-23 11:30:07 -04:00
Mike Bayer 62b2955c7a test fixes 2012-09-22 13:37:39 -04:00
Mike Bayer 9e3458c479 - [bug] Adjusted a very old bugfix which attempted
to work around a SQLite issue that itself was
    "fixed" as of sqlite 3.6.14, regarding quotes
    surrounding a table name when using
    the "foreign_key_list" pragma.  The fix has been
    adjusted to not interfere with quotes that
    are *actually in the name* of a column or table,
    to as much a degree as possible; sqlite still
    doesn't return the correct result for foreign_key_list()
    if the target table actually has quotes surrounding
    its name, as *part* of its name (i.e. """mytable""").
    [ticket:2568]
2012-09-19 00:34:30 -04:00
Mike Bayer 6a3e993490 - genericize the test for ischema_names
- some fixes to the patch to handle empty args, whitespace
- changelog clarifies where this API fits at the moment
2012-09-16 17:43:21 -04:00
Éric Lemoine 3a1cc85b20 breaking up PGDialect.get_columns, and add PostGIS column reflection tests 2012-09-12 08:55:10 +02:00
Mike Bayer f2622c0c53 - [bug] CompileError is raised when VARCHAR with
no length is attempted to be emitted, same
way as MySQL. [ticket:2505]
2012-09-10 17:02:31 -04:00
Mike Bayer d3e60f805d - [feature] The types of columns excluded from the
setinputsizes() set can be customized by sending
    a list of string DBAPI type names to exclude.
   This list was previously fixed.  The list also
    now defaults to STRING, UNICODE, removing
    CLOB, NCLOB from the list.  [ticket:2469]
2012-09-05 18:11:33 -04:00
Mike Bayer 48f5c2e4f7 - further mxodbc tweaks affecting other test suites 2012-09-02 16:17:10 -04:00
Hong Minhee 4acf7df4f5 Add a version test for EnterpriseDB 2012-08-31 07:49:01 +09: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 b48e0147ab - refine oracle returning some more to use purely positional approach 2012-08-25 20:08:52 +00:00
Mike Bayer 567ea2faef - merge 2012-08-25 19:41:43 +00:00
Mike Bayer 4d40f1b71e - more oracle tweaks for returning; the method here is still kind of brittle and might have issues with
pks, multiple function calls
2012-08-25 19:41:14 +00:00
Mike Bayer e4ff3d2a35 oracle fixes... 2012-08-25 14:19:47 -04:00
Mike Bayer 885cae7998 a few oracle fixes 2012-08-25 12:00:11 -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 2ccd77e5dc - [feature] The Query.update() method is now
more lenient as to the table
being updated.  Plain Table objects are better
supported now, and additional a joined-inheritance
subclass may be used with update(); the subclass
table will be the target of the update,
and if the parent table is referenced in the
WHERE clause, the compiler will call upon
UPDATE..FROM syntax as allowed by the dialect
to satisfy the WHERE clause.  Target columns
must still be in the target table i.e.
does not support MySQL's multi-table update
feature (even though this is in Core).
PG's DELETE..USING is also not available
in Core yet.
2012-08-20 18:18:17 -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 099c9d39eb - expand out all the methods on insert/update/delete/select for now
- remove deprecation test
2012-08-19 22:04:33 -04:00
Mike Bayer 8340361bfa - [bug] Fixed compiler bug whereby a given
select() would be modified if it had an "offset"
attribute, causing the construct to not compile
correctly a second time.  [ticket:2545]
2012-08-12 21:07:24 -04:00
Mike Bayer 7a81ecc82c - adjustments for py3.3 unit tests, [ticket:2542] 2012-08-11 21:46:48 -04:00
Mike Bayer c94756cce8 - [feature] SQL Server dialect can be given
database-qualified schema names,
i.e. "schema='mydatabase.dbo'"; reflection
operations will detect this, split the schema
among the "." to get the owner separately,
and emit a "USE mydatabase" statement before
reflecting targets within the "dbo" owner;
the existing database returned from
DB_NAME() is then restored.
2012-08-07 16:51:14 -04:00