Commit Graph

442 Commits

Author SHA1 Message Date
Mike Bayer 59ce77ca93 - [feature] the SQLite date and time types
have been overhauled to support a more open
    ended format for input and output, using
    name based format strings and regexps.  A
    new argument "microseconds" also provides
    the option to omit the "microseconds"
    portion of timestamps.  Thanks to
    Nathan Wright for the work and tests on
    this.  [ticket:2363]
2012-04-24 15:49:52 -04:00
Nathan Wright 55b4295e39 Improve SQLite DATETIME storage format handling [ticket:2363]
This breaks backwards compatibility with old SQLite DATETIME, DATE,
and TIME storage_format strings. Formatting now occurs with named instead
of positional parameters. The regexp argument can still use positional
arguments, but named groupings are also supported. This means that you can
omit fields and change the order of date fields as desired.

SQLite's DATETIME and TIME also gained a truncate_microseconds argument.
This is shorthand for modifying the format string. Fortunately the
str_to_datetime and str_to_time processors written in C already support
omitting microseconds, so we don't have to resort to python processing
for this case.
2012-03-12 21:31:12 -07:00
Nathan Wright d969d3a54a Move a SQLLite datetime test to a new DateTimeTest case 2012-03-12 15:48:29 -07:00
Mike Bayer 5c5634c04f - [bug] removed legacy behavior whereby
a column comparison to a scalar SELECT via
== would coerce to an IN with the SQL server
dialect.  This is implicit
behavior which fails in other scenarios
so is removed.  Code which relies on this
needs to be modified to use column.in_(select)
explicitly.  [ticket:2277]
2012-04-24 11:16:03 -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 fdda4b0e01 - mysql [bug] Fixed bug whereby if cast() is used
on a SQL expression whose type is not supported
by cast() and therefore CAST isn't rendered by
the dialect, the order of evaluation could change
if the casted expression required that it be
grouped; grouping is now applied to those
expressions.  [ticket:2467]
2012-04-16 12:08:32 -04:00
Mike Bayer 3d66f727f5 - test explicitly for 'VIEW', 'SYSTEM VIEW'
- move the test to the reflection tests
2012-04-12 12:21:02 -04:00
elazar 9596595dcf Fixed test_system_views not checking for MySQL >= 5.0.0 as information_schema support is not available in previous versions 2012-04-12 07:35:49 -05:00
elazar 01087224ce Modified MySQLDialect.get_view_names() to also return system views such as those in information_schema 2012-04-11 21:32:00 -05:00
Mike Bayer 3269b73ff7 - adjust mysql patch a bit so that we use
built in quoting for the "idx_" name as well
- [bug] Fixed bug whereby column name inside
of "KEY" clause for autoincrement composite
column with InnoDB would double quote a
name that's a reserved word.  Courtesy Jeff
Dairiki. [ticket:2460]
2012-04-08 11:18:39 -04:00
Jeff Dairiki b7abf86f72 Fix innodb autoinc constraint (double)quoting 2012-04-06 21:55:39 -07:00
Mike Bayer 4cb74452fe - [bug] Repaired the use_scope_identity
create_engine() flag when using the pyodbc
    dialect.  Previously this flag would be
    ignored if set to False.  When set to False,
    you'll get "SELECT @@identity" after each
    INSERT to get at the last inserted ID,
    for those tables which have "implicit_returning"
    set to False.
2012-04-05 14:31:28 -04:00
Mike Bayer 667f8f83fe - [feature] Added support for MySQL index and
primary key constraint types
(i.e. USING) via new mysql_using parameter
to Index and PrimaryKeyConstraint,
courtesy Diana Clarke.  [ticket:2386]
2012-03-14 14:32:13 -07:00
Mike Bayer 4d2c1e2f17 - [feature] Added support for MSSQL INSERT,
UPDATE, and DELETE table hints, using
new with_hint() method on UpdateBase.
[ticket:2430]
2012-03-13 14:00:05 -07:00
Nathan Wright 754e7290b4 Move a SQLLite datetime test to a new DateTimeTest case 2012-03-12 15:48:29 -07:00
Mike Bayer f37aa86df8 revert this, bad idea 2012-02-13 19:29:38 -05:00
Mike Bayer 4bbd814fff - [bug] Fixed the "render literal bind" function,
used by Alembic, to escape % signs with %%.
2012-02-13 18:53:21 -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 87a06688bc - [feature] Added a new oracle create_engine() flag
coerce_to_decimal=False, disables the precision
numeric handling which can add lots of overhead
by converting all numeric values to
Decimal.  [ticket:2399]
2012-02-12 18:45:17 -05:00
Mike Bayer ba0fb069d5 - Added missing compilation support for
LONG [ticket:2401]
- broke out oracle tests for types that only require dialect
2012-02-12 17:10:50 -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 21870c7503 - [bug] Adjusted the regexp used in the
mssql.TIME type to ensure only six digits
    are received for the "microseconds" portion
    of the value, which is expected by
    Python's datetime.time().  Note that
    support for sending microseconds doesn't
    seem to be possible yet with pyodbc
    at least.  [ticket:2340]
2012-01-22 19:17:21 -05:00
Mike Bayer 8c05a3bf65 - [feature] Added "false()" and "true()" expression
constructs to sqlalchemy.sql namespace, though
not part of __all__ as of yet.
- [bug] sql.false() and sql.true() compile to
0 and 1, respectively in sqlite [ticket:2368]
2012-01-18 12:42:54 -05:00
Mike Bayer fd13676039 that's not a "name=0", that's a counter. so name is None unconditonally.
[ticket:2348]
2012-01-07 19:49:25 -05:00
Mike Bayer a4a81f7b96 - [bug] the "name" of an FK constraint in SQLite
is reflected as "None", not "0" [ticket:2364].
SQLite does not appear to support constraint
naming in any case (the names are ignored).
2012-01-07 15:37:51 -05:00
Mike Bayer 3867ea9dc7 - [bug] pyodbc-based dialects now parse the
pyodbc accurately as far as observed
pyodbc strings, including such gems
as "py3-3.0.1-beta4" [ticket:2318]
- [bug] use new pyodbc version detection for
_need_decimal_fix option, [ticket:2318]
2011-12-04 13:29:29 -05:00
Mike Bayer 2fca3c8ee8 - [bug] repaired the with_hint() feature which
wasn't implemented correctly on MSSQL -
usually used for the "WITH (NOLOCK)" hint
(which you shouldn't be using anyway !
use snapshot isolation instead :) )
[ticket:2336]
2011-12-03 20:04:55 -05:00
Mike Bayer b854074c6d - [feature] Added create_type constructor argument
to pg.ENUM.  When False, no CREATE/DROP or
checking for the type will be performed as part
of a table create/drop event; only the
create()/drop)() methods called directly
will do this.  Helps with Alembic "offline"
scripts.
2011-11-28 22:28:28 -05: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 5397d95365 - Added client_encoding parameter to create_engine()
when the postgresql+psycopg2 dialect is used;
calls the psycopg2 set_client_encoding() method
with the value upon connect.  [ticket:1839]
2011-10-15 15:05:51 -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 771f6fba4c add a test to confirm alter table of pk column gets reflected 2011-10-04 12:30:23 -04:00
Mike Bayer 539c7a1ca2 undo that change with the _, it doesn't break round trips 2011-10-03 15:24:26 -04:00
Mike Bayer a9ebba3e1b - a CREATE TABLE will put the COLLATE option
after CHARSET, which appears to be part of
    MySQL's arbitrary rules regarding if it will actually
    work or not.  [ticket:2225]

  - reflecting a MySQL table will ensure that the
    options added to the Table at the table.kwargs
    level have spaces converted to underscores.
    This is a slight behavioral change specifically
    to the "mysql_default_charset" option which
    previously would not be symmetrical.
2011-10-03 15:19:07 -04:00
Mike Bayer bf2f3595d0 - Added "postgresql_using" argument to Index(), produces
USING clause to specify index implementation for
    PG.  [ticket:2290].  Thanks to Ryan P. Kelly for
    the patch.
2011-10-02 17:17:46 -04:00
Mike Bayer 3f347edd14 - The String type now generates VARCHAR2 on Oracle
which is recommended as the default VARCHAR.
    Added an explicit VARCHAR2 and NVARCHAR2 to the Oracle
    dialect as well.   Using NVARCHAR still generates
    "NVARCHAR2" - there is no "NVARCHAR" on Oracle -
    this remains a slight breakage of the "uppercase types
    always give exactly that" policy.  VARCHAR still
    generates "VARCHAR", keeping with the policy.   If
    Oracle were to ever define "VARCHAR" as something
    different as they claim (IMHO this will never happen),
    the type would be available.  [ticket:2252]
2011-09-24 11:02:29 -04:00
Mike Bayer c52e31b1e0 - The behavior of =/!= when comparing a scalar select
to a value will no longer produce IN/NOT IN as of 0.8;
    this behavior is a little too heavy handed (use in_() if
    you want to emit IN) and now emits a deprecation warning.
    To get the 0.8 behavior immediately and remove the warning,
    a compiler recipe is given at
    http://www.sqlalchemy.org/docs/07/dialects/mssql.html#scalar-select-comparisons
    to override the behavior of visit_binary().
    [ticket:2277]
2011-09-23 21:56:10 -04:00
Mike Bayer 843847740c - Reflection functions for Table, Sequence no longer
case insensitive.  Names can be differ only in case
    and will be correctly distinguished.  [ticket:2256]
2011-09-09 17:12:52 -04:00
Mike Bayer 5bc91d48c2 this test only runs for PG 2011-08-12 22:58:46 -04:00
Mike Bayer 8b505e7c24 - Narrowed the assumption made when reflecting
a foreign-key referenced table with schema in
the current search path; an explicit schema will
be applied to the referenced table only if
it actually matches that of the referencing table,
which also has an explicit schema.   Previously
it was assumed that "current" schema was synonymous
with the full search_path.  [ticket:2249]
2011-08-09 19:45:20 -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
Mike Bayer 757400f82f - Ensured that the same ValueError is raised for
illegal date/time/datetime string parsed from
    the database regardless of whether C
    extensions are in use or not.
2011-08-04 15:34:24 -04:00
Mike Bayer 086ae95614 - SQLite dialect no longer strips quotes
off of reflected default value, allowing
    a round trip CREATE TABLE to work.
    This is consistent with other dialects
    that also maintain the exact form of
    the default.  [ticket:2189]
2011-07-28 11:53:18 -04:00
Mike Bayer 1ae69566cc fix keyword error 2011-07-20 11:09:04 -04:00
Mike Bayer b2d50f2807 - Added new "postgresql_ops" argument to
Index, allows specification of PostgreSQL
    operator classes for indexed columns.
    [ticket:2198]  Courtesy Filip Zyzniewski.
2011-07-20 10:49:36 -04:00
Mike Bayer bd45f22e17 - repaired the oracle.RAW type which did not
generate the correct DDL.  [ticket:2220]
Also in 0.6.9.
2011-07-19 11:44:21 -04:00
Mike Bayer 772ae63bdb add test for [ticket:2159] 2011-06-05 12:32:04 -04:00
Mike Bayer c0f9221160 - Some unit test fixes regarding numeric arrays,
MATCH operator.   A potential floating-point
inaccuracy issue was fixed, and certain tests
of the MATCH operator only execute within an
EN-oriented locale for now.  [ticket:2175].
Also in 0.6.8.
2011-06-04 20:20:28 -04:00
Mike Bayer ef654af35a - Fixed bug affecting PG 9 whereby index reflection
would fail if against a column whose name
had changed.  [ticket:2141].  Also in 0.6.8.
2011-05-20 17:53:13 -04:00
Mike Bayer c7713a6f0a - Fixed bug in MSSQL dialect whereby the aliasing
applied to a schema-qualified table would leak
    into enclosing select statements [ticket:2169].
    Also in 0.6.8.
2011-05-19 12:00:47 -04:00