Commit Graph

39 Commits

Author SHA1 Message Date
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 754e7290b4 Move a SQLLite datetime test to a new DateTimeTest case 2012-03-12 15:48:29 -07: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 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 c67b0c56a3 test only runs on sqlite 2011-04-10 20:53:14 -04:00
Mike Bayer fb97a666bb - Fixed bug where reflection of foreign key
created as "REFERENCES <tablename>" without
col name would fail.  [ticket:2115]
(also in 0.6.7)
2011-04-10 10:47:34 -04:00
Mike Bayer 7b24e458c7 - move all the comments that got shoved below the fixture grabs back up 2011-03-27 17:19:00 -04:00
Mike Bayer 68a350d462 - remove test.sql._base, test.engine._base, test.orm._base, move those classes to a new test.lib.fixtures module
- move testing.TestBase to test.lib.fixtures
- massive search and replace
2011-03-27 16:27:27 -04:00
Mike Bayer ebd0fdad73 - convert @provide_metadata to use self access
- having occasional issues with BasicEntity grabbing, if it persists
may have to pass an explicit base class into setup_classes()/setup_mappers()
2011-03-26 21:40:05 -04:00
Mike Bayer ed4534ea8a fix sqlite test 2011-02-11 00:24:38 -05:00
Mike Bayer e43f85965e - The path given as the location of a sqlite database is now
normalized via os.path.abspath(), so that directory changes
within the process don't affect the ultimate location
of a relative file path.  [ticket:2036]
2011-02-10 15:03:11 -05:00
Mike Bayer 7e8f351097 - Non-DBAPI errors which occur in the scope of an execute()
call are now wrapped in sqlalchemy.exc.StatementError,
and the text of the SQL statement and repr() of params
is included.  This makes it easier to identify statement
executions which fail before the DBAPI becomes
involved.  [ticket:2015]
2011-02-09 18:11:40 -05:00
Mike Bayer aa62a3a833 - factor consistent set_isolation_level(), get_isolation_level()
per-connection methods for sqlite, postgresql, psycopg2 dialects
- move isolation test suite to test engines/test_transaction
- preparing for [ticket:2001]
2011-01-16 13:05:18 -05:00
Mike Bayer af3bfefc62 - fix reflection of unknown types with arguments, NullType() accepts no arguments. 2011-01-12 17:17:33 -05:00
Mike Bayer 67e0f356b2 - A TypeDecorator of Integer can be used with a primary key
column, and the "autoincrement" feature of various dialects
  as well as the "sqlite_autoincrement" flag will honor
  the underlying database type as being Integer-based.
 [ticket:2005]

- Result-row processors are applied to pre-executed SQL
  defaults, as well as cursor.lastrowid, when determining
  the contents of result.inserted_primary_key.
  [ticket:2006]

- Bind parameters present in the "columns clause" of a select
  are now auto-labeled like other "anonymous" clauses,
  which among other things allows their "type" to be meaningful
  when the row is fetched, as in result row processors.

- TypeDecorator is present in the "sqlalchemy" import space.
2011-01-11 15:22:46 -05:00
Mike Bayer 350aed3fdb - whitespace removal bonanza 2011-01-02 14:23:42 -05:00
Mike Bayer 58b2939433 - sqlalchemy.test and nose plugin moves back to being entirely
outside of "sqlalchemy" and under "test/".

Rationale:

- coverage plugin works without issue, without need for an awkward
additional package install
- command line for "nosetests" isn't polluted with SQLAlchemy options

[ticket:1949]
2010-11-28 14:19:44 -05:00
Mike Bayer 61840abbce - NullPool is now used by default for SQLite file-
based databases.  :memory: databases will continue
 to select SingletonThreadPool by default.
 [ticket:1921]
2010-11-28 12:00:01 -05:00
Mike Bayer e1402efb19 - move sqlalchemy.test to test.lib 2010-11-15 19:37:50 -05:00
Mike Bayer d3ee4f6155 - On the same theme, the REFERENCES clause in a CREATE TABLE
that includes a remote schema to a *different* schema
than that of the parent table doesn't render at all,
as cross-schema references do not appear to be supported.
2010-11-12 10:49:17 -05:00
Mike Bayer bbe3f0a27c - The REFERENCES clause in a CREATE TABLE that includes
a remote schema name now renders the remote name without
the schema clause, as required by SQLite.  [ticket:1851]
2010-11-12 10:36:03 -05:00
Mike Bayer e430aa915f test/dialect 2010-07-11 14:28:21 -04:00
Mike Bayer 035ec314f6 - Fixed concatenation of constraints when "PRIMARY KEY"
constraint gets moved to column level due to SQLite
AUTOINCREMENT keyword being rendered.  [ticket:1812]
- remove some extra space in between constraint DDL
- added alias() to binary comparison test, fixing pg + mysql failures
2010-05-27 14:46:44 -04:00
Mike Bayer 2438b38881 fix sqlite tests 2010-03-19 17:52:34 -04:00
Michael Trier 824e42b1e6 Match tests have been completely wrong. 2010-02-26 08:50:04 +00:00
Mike Bayer 756370e0b4 - The assert_unicode flag is deprecated. SQLAlchemy will raise
a warning in all cases where it is asked to encode a non-unicode
Python string, and will do nothing for DBAPIs that already
accept Python unicode objects.
2010-02-25 22:00:58 +00:00
Mike Bayer 44626e9659 - Added "native_datetime=True" flag to create_engine().
This will cause the DATE and TIMESTAMP types to skip
     all bind parameter and result row processing, under
     the assumption that PARSE_DECLTYPES has been enabled
     on the connection.  Note that this is not entirely
     compatible with the "func.current_date()", which
     will be returned as a string. [ticket:1685]
2010-02-11 02:23:32 +00:00
Mike Bayer 33f2e2bfbb - Column() supports a keyword argument "sqlite_autoincrement", which
applies the SQLite keyword "AUTOINCREMENT" to columns within DDL -
will prevent generation of a separate PRIMARY KEY constraint.
[ticket:1016]
- added docs
- fixed underlines in mysql.rst
2009-12-18 21:08:35 +00:00
Mike Bayer 048f70ce85 - sqlite dialect properly generates CREATE INDEX for a table
that is in an alternate schema.  [ticket:1439]
2009-12-07 23:08:42 +00:00
Mike Bayer 7dc4df8a68 - The Boolean type, when used on a backend that doesn't
have native boolean support, will generate a CHECK
constraint "col IN (0, 1)" along with the int/smallint-
based column type.  This can be switched off if
desired with create_constraint=False.
Note that MySQL has no native boolean *or* CHECK constraint
support so this feature isn't available on that platform.
[ticket:1589]
2009-12-06 22:58:05 +00:00
Mike Bayer f9cb6f5834 - reworked the DDL generation of ENUM and similar to be more platform agnostic.
Uses a straight CheckConstraint with a generic expression.  Preparing for boolean
constraint in [ticket:1589]
- CheckConstraint now accepts SQL expressions, though support for quoting of values
will be very limited.  we don't want to get into formatting dates and such.
2009-12-06 19:51:10 +00:00
Mike Bayer 5f6ed1a3f8 - pg8000 + postgresql dialects now check for float/numeric return
types to more intelligently determine float() vs. Decimal(),
[ticket:1567]
- since result processing is a hot issue of late, the DBAPI type
returned from cursor.description is certainly useful in cases like
these to determine an efficient result processor.   There's likely
other result processors that can make use of it.  But, backwards
incompat change to result_processor().  Happy major version number..
2009-11-15 19:20:22 +00:00
Mike Bayer 8e8da289d5 - boolean, int, and float arguments count as "cache key" values for inspector info_cache()
- added awareness of sqlite implicit auto indexes [ticket:1551]
2009-10-01 23:00:02 +00:00
Philip Jenvey 5a9c1b8824 merge from branches/clauseelement-nonzero
adds a __nonzero__ to _BinaryExpression to avoid faulty comparisons during hash
collisions (which only occur on Jython)
fixes #1547
2009-09-24 02:11:56 +00:00
Mike Bayer 8fc5005dfe merge 0.6 series to trunk. 2009-08-06 21:11:27 +00:00
Mike Bayer 45cec095b4 - unit tests have been migrated from unittest to nose.
See README.unittests for information on how to run
the tests.  [ticket:970]
2009-06-10 21:18:24 +00:00