Commit Graph

68 Commits

Author SHA1 Message Date
Jason Kirtland c83bb94e0d Added UnicodeText alias 2008-01-09 20:22:41 +00:00
Mike Bayer eefd1f78a2 redid the _for_ddl String/Text deprecation warning correctly [ticket:912] 2008-01-09 18:09:49 +00:00
Mike Bayer a8b62a02dd - further fix to new TypeDecorator, so that subclasses of TypeDecorators work properly
- _handle_dbapi_exception() usage changed so that unwrapped exceptions can be rethrown with the original stack trace
2008-01-02 01:29:38 +00:00
Mike Bayer 226a95cb4f fix to new TypeDecorator 2008-01-01 01:47:58 +00:00
Mike Bayer 267523e4da - sqlite SLDate type will not erroneously render "microseconds" portion
of a datetime or time object when sent to the DB.
2007-12-20 01:45:36 +00:00
Mike Bayer b9b0aca757 - auto-reconnect support improved; a Connection can now automatically
reconnect after its underlying connection is invalidated, without
needing to connect() again from the engine.  This allows an ORM session
bound to a single Connection to not need a reconnect.
Open transactions on the Connection must be rolled back after an invalidation
of the underlying connection else an error is raised.  Also fixed
bug where disconnect detect was not being called for cursor(), rollback(),
or commit().
2007-12-19 19:51:46 +00:00
Mike Bayer df68f30777 get most oracle tests in sql working again.... 2007-12-18 06:13:42 +00:00
Mike Bayer 8cf05355bb oof...unicode object still needs to return the value if it just warned... 2007-12-14 23:47:33 +00:00
Mike Bayer c9b3f0bcef - added new methods to TypeDecorator, process_bind_param() and
process_result_value(), which automatically take advantage of the processing
of the underlying type.  Ideal for using with Unicode or Pickletype.
TypeDecorator should now be the primary way to augment the behavior of any
existing type including other TypeDecorator subclasses such as PickleType.
2007-12-08 23:03:22 +00:00
Mike Bayer 594784a206 assert_unicode=True replaced with default of assert_unicode='warn' 2007-12-05 22:21:37 +00:00
Mike Bayer d56e11ffe2 default value of assert_unicode is None on String, False on create_engine(), and True on Unicode type. 2007-11-28 00:44:16 +00:00
Paul Johnston 2c873f0ee4 Fix: test_decimal on MSSQL - use a value that is accurately represented as a float, and make when asdecimal=False, convert Decimal to float 2007-11-25 23:34:39 +00:00
Mike Bayer e4056a1787 - added new flag to String and create_engine(), assert_unicode=(True|False|None).
When convert_unicode=True, this flag also defaults to `True`, and results in all
unicode conversion operations raising an exception when a non-unicode bytestring
is passed as a bind parameter.  It is strongly advised that all unicode-aware
applications make proper use of Python unicode objects (i.e. u'hello' and
not 'hello').
2007-11-25 23:14:03 +00:00
Mike Bayer ea46e556f9 - anonymous column expressions are automatically labeled.
e.g. select([x* 5]) produces "SELECT x * 5 AS anon_1".
    This allows the labelname to be present in the cursor.description
    which can then be appropriately matched to result-column processing
    rules. (we can't reliably use positional tracking for result-column
    matches since text() expressions may represent multiple columns).

  - operator overloading is now controlled by TypeEngine objects - the
    one built-in operator overload so far is String types overloading
    '+' to be the string concatenation operator.
    User-defined types can also define their own operator overloading
    by overriding the adapt_operator(self, op) method.

  - untyped bind parameters on the right side of a binary expression
    will be assigned the type of the left side of the operation, to better
    enable the appropriate bind parameter processing to take effect
    [ticket:819]
2007-11-10 03:02:16 +00:00
Jason Kirtland c2092c7254 - Refinements for maxdb's handling of SERIAL and FIXED columns
- Expanded maxdb's set of paren-less functions
2007-10-31 00:28:53 +00:00
Jason Kirtland 6378c34799 - Added initial version of MaxDB dialect.
- All optional test Sequences are now optional=True
2007-10-23 07:38:07 +00:00
Roger Demetrescu 69ba01265e Firebird: added Float and Time types (FBFloat and FBTime). Fixed BLOB SUB_TYPE for TEXT and Binary types.
Firebird's string types are tested in testtypes.py
2007-10-12 06:02:15 +00:00
Jason Kirtland c1a8db6791 - sqlite housekeeping- added dialect test & moved tests there, pruned the dialect's reserved words. 2007-10-11 17:35:13 +00:00
Mike Bayer 29291f4c32 - oracle does not implicitly convert to unicode for non-typed result
sets (i.e. when no TypeEngine/String/Unicode type is even being used;
  previously it was detecting DBAPI types and converting regardless).
  should fix [ticket:800]
- fixed oracle out_parameters, likely broke in beta6
- fixed oracle _normalize_case for encoded names, gets unicode reflection test to work
- a few extra tests tweaked/unsupported for oracle
2007-10-06 16:12:58 +00:00
Jason Kirtland 73b0c40946 - Tweaked the sql.text date test 2007-10-02 20:58:58 +00:00
Jason Kirtland 1880e6d8c3 - Unraveled DateTest, removed bogus coverage omission for MySQL TIME types 2007-10-02 20:51:17 +00:00
Mike Bayer e37a3a961c - the behavior of String/Unicode types regarding that they auto-convert
to TEXT/CLOB when no length is present now occurs *only* for an exact type
  of String or Unicode with no arguments.  If you use VARCHAR or NCHAR
  (subclasses of String/Unicode) with no length, they will be interpreted
  by the dialect as VARCHAR/NCHAR; no "magic" conversion happens there.
  This is less surprising behavior and in particular this helps Oracle keep
  string-based bind parameters as VARCHARs and not CLOBs [ticket:793].
2007-09-26 14:55:44 +00:00
Jason Kirtland fba14f6047 from foo import (name, name) isn't valid syntax for 2.3. ah well.
omitting modules from sqlalchemy.__all__...
2007-08-21 22:20:52 +00:00
Jason Kirtland 6228e72cb1 - omitted 'table' and 'column' from 'from sqlalchemy import *'
- also omitted all modules and classes that aren't expicitly public
- omitted 'Smallinteger' (small i), but it's still in schema
- omitted NullType-related items from types.__all__
- patched up a few tests to use sql.table and sql.column, other related.
2007-08-21 01:31:23 +00:00
Paul Johnston 1b1da969eb mssql unit test fixes 2007-08-19 15:30:02 +00:00
Mike Bayer 7c6c1b99c2 1. Module layout. sql.py and related move into a package called "sql".
2. compiler names changed to be less verbose, unused classes removed.
3. Methods on Dialect which return compilers, schema generators, identifier preparers
have changed to direct class references, typically on the Dialect class itself
or optionally as attributes on an individual Dialect instance if conditional behavior is needed.
This takes away the need for Dialect subclasses to know how to instantiate these
objects, and also reduces method overhead by one call for each one.
4. as a result of 3., some internal signatures have changed for things like compiler() (now statement_compiler()), preparer(), etc., mostly in that the dialect needs to be passed explicitly as the first argument (since they are just class references now).  The compiler() method on Engine and Connection is now also named statement_compiler(), but as before does not take the dialect as an argument.

5. changed _process_row function on RowProxy to be a class reference, cuts out 50K method calls from insertspeed.py
2007-08-18 21:37:48 +00:00
Mike Bayer 74595d900c - Added a "legacy" adapter to types, such that user-defined TypeEngine
and TypeDecorator classes which define convert_bind_param()/convert_result_value()
  will continue to function.  Also supports calling the super() version of
  those methods.
2007-08-17 23:45:29 +00:00
Mike Bayer 13af7230dc - fix to bind param processing such that "False" values (like blank strings)
still get processed/encoded
2007-08-16 18:25:11 +00:00
Mike Bayer dd99a207d6 added support for string date passthru in sqlite 2007-08-16 14:48:48 +00:00
Mike Bayer 087f235c33 - merged "fasttypes" branch. this branch changes the signature
of convert_bind_param() and convert_result_value() to callable-returning
bind_processor() and result_processor() methods.  if no callable is
returned, no pre/post processing function is called.
- hooks added throughout base/sql/defaults to optimize the calling
of bind param/result processors so that method call overhead is minimized.
special cases added for executemany() scenarios such that unneeded "last row id"
logic doesn't kick in, parameters aren't excessively traversed.
- new performance tests show a combined mass-insert/mass-select test as having 68%
fewer function calls than the same test run against 0.3.
- general performance improvement of result set iteration is around 10-20%.
2007-08-14 21:53:32 +00:00
Mike Bayer ed4fc64bb0 merging 0.4 branch to trunk. see CHANGES for details. 0.3 moves to maintenance branch in branches/rel_0_3. 2007-07-27 04:08:53 +00:00
Rick Morrison 1c66e35132 mssql: added support for TIME type (simulated via DATETIME col) [ticket:679] 2007-07-26 16:51:09 +00:00
Mike Bayer 471c3f8102 updated interval type for [ticket:595] 2007-07-15 15:29:41 +00:00
Mike Bayer e40a6183a0 - fixed unicode conversion in Oracle TEXT type 2007-07-15 04:24:41 +00:00
Jason Kirtland 177d30cc01 - Deprecated DynamicMetaData- use ThreadLocalMetaData or MetaData instead
- Deprecated BoundMetaData- use MetaData instead
- Removed DMD and BMD from documentation
2007-07-06 00:58:09 +00:00
Mike Bayer 3f3d84e754 postgres:
- added support for reflection of domains [ticket:570]
    - types which are missing during reflection resolve to Null type
      instead of raising an error
    - moved reflection/types/query unit tests specific to postgres to new
      postgres unittest module
2007-06-29 23:50:25 +00:00
Mike Bayer 1af29a42d2 - added dialect flag "auto_convert_lobs", defaults to True; will cause any
LOB objects detected in a result set to be forced into OracleBinary
so that the LOB is read() automatically, if no typemap was present
(i.e., if a textual execute() was issued).
2007-06-22 15:36:54 +00:00
Mike Bayer 6ba5ecb379 - added Interval type to types.py [ticket:595] 2007-06-17 01:18:31 +00:00
Mike Bayer 23525a3ea8 - datetime fixes: got subsecond TIMESTAMP to work [ticket:604],
added OracleDate which supports types.Date with only year/month/day
2007-06-17 00:13:31 +00:00
Mike Bayer 93215f429d - sqlite better handles datetime/date/time objects mixed and matched
with various Date/Time/DateTime columns
2007-06-17 00:10:04 +00:00
Mike Bayer d1e474ed74 test case for oracle timestamp adaption 2007-06-16 23:36:19 +00:00
Paul Johnston 2c65ce7536 Multiple MSSQL fixes; see ticket #581 2007-06-13 18:53:16 +00:00
Jason Kirtland e4cd7b2ed4 - MySQL TEXT-derived types weren't respecting convert_unicode, fixes #601
- unicode type test now exercises Unicode() and Unicode(len)
2007-06-13 17:47:54 +00:00
Jason Kirtland d03b5327b7 - MySQL ENUM types can now optionally ensure that values are within the
enum's allowed range on insert and update, with strict=True
- Added new 'dialect' category of unit tests, and migrated MySQL-specific
  dialect tests there.
- Noted the max identifier length in the MySQL dialect (the max alias length,
  actually)
2007-05-02 00:41:52 +00:00
Jason Kirtland 546518d75c - allow MySQL column-level CHARACTER SET and COLLATE, plus shortcuts like
ASCII, UNICODE, and BINARY.  support NATIONAL.
- added MySQL-specific reserved words
- added tests for MySQL numeric and string column DDL generation
- various minor cleanups, also tweak regex to not break emacs syntax hilighting
2007-05-01 00:05:47 +00:00
Mike Bayer aabb6e530b - the dialects within sqlalchemy.databases become a setuptools
entry points. loading the built-in database dialects works the
same as always, but if none found will fall back to trying
pkg_resources to load an external module [ticket:521]
2007-04-17 20:49:35 +00:00
Mike Bayer cdceb3c371 - merged the "execcontext" branch, refactors engine/dialect codepaths
- much more functionality moved into ExecutionContext, which impacted
the API used by dialects to some degree
- ResultProxy and subclasses now designed sanely
- merged patch for #522, Unicode subclasses String directly,
MSNVarchar implements for MS-SQL, removed MSUnicode.
- String moves its "VARCHAR"/"TEXT" switchy thing into
"get_search_list()" function, which VARCHAR and CHAR can override
to not return TEXT in any case (didnt do the latter yet)
- implements server side cursors for postgres, unit tests, #514
- includes overhaul of dbapi import strategy #480, all dbapi
importing happens in dialect method "dbapi()", is only called
inside of create_engine() for default and threadlocal strategies.
Dialect subclasses have a datamember "dbapi" referencing the loaded
module which may be None.
- added "mock" engine strategy, doesnt require DBAPI module and
gives you a "Connecition" which just sends all executes to a callable.
can be used to create string output of create_all()/drop_all().
2007-04-02 21:36:11 +00:00
Mike Bayer 320cb9b75f - oracle:
- got binary working for any size input !  cx_oracle works fine,
      it was my fault as BINARY was being passed and not BLOB for
      setinputsizes (also unit tests werent even setting input sizes).
    - auto_setinputsizes defaults to True for Oracle, fixed cases where
      it improperly propigated bad types.
2007-03-10 23:31:40 +00:00
Rick Morrison e7ac502b81 Completed previously missed patches from tickets 422 and 415
get unit tests to work with pyodbc [ticket:481]
fix blank password on adodbapi [ticket:371]
2007-02-18 19:43:05 +00:00
Mike Bayer 5f83c55fc7 - fixed oracle list of binary types to check for their presence in the module (such as BFILE not in all versions of cx_Oracle)
- removed oracle-handicap from binary unit test to test [ticket:435] fix, added an extra row containing None
2007-02-17 01:18:54 +00:00