Commit Graph

803 Commits

Author SHA1 Message Date
Mike Bayer e1802ff542 - using AssertsCompiledSQL so need __dialect__ 2013-12-17 15:33:27 -05:00
Mike Bayer 73013914e7 - rework JSON expressions to be based off __getitem__ exclusively
- add support for "standalone" JSON objects; this involves getting CAST
to upgrade the given type of a bound parameter.  should add a core-only test
for this.
- add tests for "standalone" json round trips both with and without unicode
- add mechanism by which we remove psycopg2's "json" handler in order to get
the effect of using our non-native result handlers
2013-12-17 15:13:39 -05:00
Mike Bayer 2c3afb4dcb Merge branch 'issue_2581' of github.com:nathan-rice/sqlalchemy into pg_json 2013-12-17 14:03:20 -05:00
John Anderson 3147ca3040 Remove terminated connections from the pool.
In pymssql, if you terminate a long running query manually
it will give you a connection reset by peer message, but this
connection remains in the pool and will be re-used.
2013-12-16 12:50:10 -08:00
nathan 015c73c83a sqlalchemy/dialects/postgresql/pgjson:
- Added support for additional operators
 - Made return as json default (rather than text)
2013-12-11 10:21:08 -05:00
nathan f285b3536f sqlalchemy/dialects/postgresql/pgjson:
- Fixed reference to HSTORE
 - Corrected spelling of SQLAlchemy

 sqlalchemy/dialects/postgresql/psycopg2:
 - Added psycopg2 specific wrapper type for JSON which uses inherent json deserialization facilities
 - Added code to detect and utilize the JSON wrapper if psycopg2 >= 2.5

test/dialect/postgresql/test_types:
- removed reference to use_native_hstore
2013-12-10 10:01:51 -05:00
Mike Bayer 164bff0749 - round trip test
- changelog
- some doc rearrangement
2013-12-09 21:27:14 -05:00
Noufal Ibrahim d3b65cd9bc Adds test to verify tsvector creation.
Signed-off-by: Noufal Ibrahim <noufal@nibrahim.net.in>
2013-12-10 01:07:53 +05:30
nathan ba73d619ca Merge branch 'rel_0_9' of https://github.com/nathan-rice/sqlalchemy into rel_0_9 2013-12-09 11:52:23 -05:00
nathan 64288c7d6f sqlalchemy/dialects/postgresql/__init__.py:
- Added import references to JSON class

 sqlalchemy/dialects/postgresql/base.py:
 - Added visitor method for JSON class

 sqlalchemy/dialects/postgresql/pgjson (new):
 - JSON class, supports automatic serialization and deserialization of json data, as well as basic json operators.
2013-12-09 11:46:36 -05:00
Mike Bayer 3621e4b8de - changelog + test for pullreq #7, MSSQL dialect for DROP INDEX 2013-12-05 18:36:59 -05:00
Mike Bayer d52db834a5 - move additional enum compilation tests to postgresql/test_compiler.py 2013-11-30 16:12:20 -05:00
Mike Bayer 66773a8801 - Fixed bug where values within an ENUM weren't escaped for single
quote signs.   Note that this is backwards-incompatible for existing
workarounds that manually escape the single quotes. [ticket:2878]
2013-11-30 13:53:26 -05:00
Mike Bayer 31cecebd48 - add support for specifying tables or entities for "of"
- implement Query with_for_update()
- rework docs and tests
2013-11-28 23:23:27 -05:00
Mike Bayer 4aaf3753d7 - fix up rendering of "of"
- move out tests, dialect specific out of compiler, compiler tests use new API,
legacy API tests in test_selecatble
- add support for adaptation of ForUpdateArg, alias support in compilers
2013-11-28 22:25:09 -05:00
Mike Bayer 69b9f62afc - this test only for mysql 2013-11-23 17:05:45 -05:00
Mike Bayer 6b79d2ea79 - The precision used when coercing a returned floating point value to
Python ``Decimal`` via string is now configurable.  The
flag ``decimal_return_scale`` is now supported by all :class:`.Numeric`
and :class:`.Float` types, which will ensure this many digits are taken
from the native floating point value when it is converted to string.
If not present, the type will make use of the value of ``.scale``, if
the type supports this setting and it is non-None.  Otherwise the original
default length of 10 is used. [ticket:2867]
2013-11-22 20:04:19 -05:00
Mike Bayer 467784e89c Fixed bug where Oracle `VARCHAR` types given with no length
(e.g. for a ``CAST`` or similar) would incorrectly render ``None CHAR``
or similar. [ticket:2870]
2013-11-22 17:56:35 -05:00
Mike Bayer 6661cba88d - cleanup 2013-11-22 17:48:55 -05:00
Mike Bayer 59ca4633ac - remove informix dialect, moved out to https://bitbucket.org/zzzeek/sqlalchemy_informixdb
- remove informix, maxdb, access symbols from tests etc.
2013-11-17 13:45:23 -05:00
Mike Bayer 5070c81ab9 - Fixed bug where Oracle table reflection using synonyms would fail
if the synonym and the table were in different remote schemas.
Patch to fix courtesy Kyle Derr. [ticket:2853]
2013-10-25 19:11:53 -04:00
Mike Bayer 46ac022e57 - move this test to PG test_reflection
- don't use locals()
2013-10-25 17:19:03 -04:00
Mike Bayer 51e8e5df46 - Fix and test parsing of MySQL foreign key options within reflection;
this complements the work in 🎫`2183` where we begin to support
reflection of foreign key options such as ON UPDATE/ON DELETE
cascade. [ticket:2839]
2013-10-25 17:18:40 -04:00
Mike Bayer e5a42a748b Merge branch 'master' of github.com:ijl/sqlalchemy into merge_2183 2013-10-25 17:01:38 -04:00
Mike Bayer fff9079909 - Removed a 128-character truncation from the reflection of the
server default for a column; this code was original from
PG system views which truncated the string for readability.
[ticket:2844]
2013-10-18 19:00:05 -04:00
Mike Bayer ca02882c6a - The change in 🎫2721, which is that the `deferrable` keyword
of :class:`.ForeignKeyConstraint` is silently ignored on the MySQL
backend, will be reverted as of 0.9; this keyword will now render again, raising
errors on MySQL as it is not understood - the same behavior will also
apply to the ``initially`` keyword.  In 0.8, the keywords will remain
ignored but a warning is emitted.   Additionally, the ``match`` keyword
now raises a :class:`.CompileError` on 0.9 and emits a warning on 0.8;
this keyword is not only silently ignored by MySQL but also breaks
the ON UPDATE/ON DELETE options.

To use a :class:`.ForeignKeyConstraint`
that does not render or renders differently on MySQL, use a custom
compilation option.  An example of this usage has been added to the
documentation, see :ref:`mysql_foreign_keys`.
[ticket:2721] [ticket:2839]
2013-10-18 14:44:01 -04:00
Mike Bayer a5dc173ea6 - Added support for rendering `SMALLSERIAL when a :class:.SmallInteger`
type is used on a primary key autoincrement column, based on server
version detection of Postgresql version 9.2 or greater.
[ticket:2840]
2013-10-15 19:06:21 -04:00
Mike Bayer 92534dc8f3 The MySQL :class:.mysql.SET type now features the same auto-quoting
behavior as that of :class:`.mysql.ENUM`.  Quotes are not required when
setting up the value, but quotes that are present will be auto-detected
along with a warning.  This also helps with Alembic where
the SET type doesn't render with quotes. [ticket:2817]
2013-10-14 16:12:54 -04:00
Mike Bayer 366e74b1be MySQL-connector dialect now allows options in the create_engine
query string to override those defaults set up in the connect,
including "buffered" and "raise_on_warnings".
[ticket:2515]
2013-10-13 14:09:35 -04:00
Mike Bayer a2cce1bf43 Parenthesis will be applied to a compound SQL expression as
rendered in the column list of a CREATE INDEX statement.
[ticket:2742]
2013-10-12 20:21:18 -04:00
Mike Bayer 9bc9d5c106 - Fixed bug in default compiler plus those of postgresql, mysql, and
mssql to ensure that any literal SQL expression values are
rendered directly as literals, instead of as bound parameters,
within a CREATE INDEX statement. [ticket:2742]
- don't need expression_as_ddl(); literal_binds and include_table
take care of this functionality.
2013-10-12 20:04:55 -04:00
ijl 9d952e0a11 PostgreSQL foreign key inspection includes options 2013-10-11 15:01:14 -04:00
Mike Bayer 94d421ca2f - put exact version string in the test
- use match with a .* preceding instead of search
2013-09-29 17:24:29 -04:00
Mike Bayer 62463b95e0 add test for upcoming pullreq 2013-09-29 17:19:25 -04:00
Mike Bayer 08a6a8b519 - Removed some now unneeded version checks [ticket:2829] courtesy alex gaynor 2013-09-22 20:35:40 -04:00
Mike Bayer 63488b2d1e The newly added SQLite DATETIME arguments storage_format and
regexp apparently were not fully implemented correctly; while the
arguments were accepted, in practice they would have no effect;
this has been fixed.  Also in 0.8.3.
[ticket:2781]
2013-07-12 21:52:54 -04:00
Mike Bayer 167adac5dc for this test, apparently we don't handle sets as unordered since neither does
MySQL.  for some reason set ordering was constant when testing mysqldb, but not
so with oursql.
2013-07-02 20:35:01 -04:00
Mike Bayer 1fb6c4a33d Added :class:.BIGINT to the list of type names that can be
reflected by the SQLite dialect; courtesy Russell Stuart.
[ticket:2764]
2013-07-02 18:10:08 -04:00
Mike Bayer 868da0c281 Added new flag `retaining=False` to the kinterbasdb and fdb dialects.
This controls the value of the ``retaining`` flag sent to the
``commit()`` and ``rollback()`` methods of the DBAPI connection.
Defaults to False.  Also in 0.8.2, where it defaults to True.
[ticket:2763]
2013-06-30 19:48:48 -04:00
Mike Bayer b38a76cd1d - replace most explicitly-named test objects called "Mock..." with
actual mock objects from the mock library.  I'd like to use mock
for new tests so we might as well use it in obvious places.
- use unittest.mock in py3.3
- changelog
- add a note to README.unittests
- add tests_require in setup.py
- have tests import from sqlalchemy.testing.mock
- apply usage of mock to one of the event tests.  we can be using
this approach all over the place.
2013-06-30 18:35:12 -04:00
Mike Bayer 3dde982171 set UTC timezone on the connection here so we can get consistent results 2013-06-29 11:08:07 -04:00
Mike Bayer d875f677a3 The behavior of :func:.extract has been simplified on the
Postgresql dialect to no longer inject a hardcoded ``::timestamp``
or similar cast into the given expression, as this interfered
with types such as timezone-aware datetimes, but also
does not appear to be at all necessary with modern versions
of psycopg2.  Also in 0.8.2.
[ticket:2740]
2013-06-28 23:53:27 -04:00
Mike Bayer 1c23741b8e refactor test suites for postgresql, mssql, mysql into packages. 2013-06-28 22:30:11 -04:00
Mike Bayer 04b66bc5e7 Fixed bug in HSTORE type where keys/values that contained
backslashed quotes would not be escaped correctly when
using the "non native" (i.e. non-psycopg2) means
of translating HSTORE data.  Patch courtesy Ryan Kelly.
[ticket:2766]
2013-06-28 11:35:57 -04:00
Mike Bayer 1144704180 YEAR(2) emits a warning and oursql / mysqlconnector throw an exception
on the warning so just dump it
2013-06-23 20:13:28 -04:00
Roman Podolyaka 25b4637bcd Fix unicode literals on Python 3.1 and 3.2
A few tests use u'' unicode literals which are not
supported in Python versions 3.1 and 3.2.
2013-06-23 12:57:53 +03:00
Mike Bayer db24d2e813 this locale is not needed. maybe it is somewhere but the locale I have ("C", whatever that means,
cannot find meaning of this anywhere in Postgresql documentation) seems to work
2013-06-22 11:25:41 -04:00
mike bayer 29fa6913be Merge pull request #5 from cjw296/pg-ranges
Support for Postgres range types.
2013-06-22 07:47:02 -07:00
Mike Bayer 0e83f757a8 can remove this, issue is fixed 2013-06-17 16:05:11 -04:00
Mike Bayer 07e6161c6b - clean up this test (really we don't even need this, it's not testing much)
- for the moment, put a catch in it to see if we can trap that issue
on jenkins
2013-06-16 23:09:31 -04:00