summaryrefslogtreecommitdiff
path: root/test/sql/test_insert.py
Commit message (Collapse)AuthorAgeFilesLines
* - :meth:`.Insert.from_select` now includes Python and SQL-expressionMike Bayer2014-10-101-2/+80
| | | | | | | defaults if otherwise unspecified; the limitation where non- server column defaults aren't included in an INSERT FROM SELECT is now lifted and these expressions are rendered as constants into the SELECT statement.
* - The :func:`~.expression.column` and :func:`~.expression.table`Mike Bayer2014-09-011-4/+4
| | | | | | | | | | | | | | | | | | | | | constructs are now importable from the "from sqlalchemy" namespace, just like every other Core construct. - The implicit conversion of strings to :func:`.text` constructs when passed to most builder methods of :func:`.select` as well as :class:`.Query` now emits a warning with just the plain string sent. The textual conversion still proceeds normally, however. The only method that accepts a string without a warning are the "label reference" methods like order_by(), group_by(); these functions will now at compile time attempt to resolve a single string argument to a column or label expression present in the selectable; if none is located, the expression still renders, but you get the warning again. The rationale here is that the implicit conversion from string to text is more unexpected than not these days, and it is better that the user send more direction to the Core / ORM when passing a raw string as to what direction should be taken. Core/ORM tutorials have been updated to go more in depth as to how text is handled. fixes #2992
* - The INSERT...FROM SELECT construct now implies ``inline=True``Mike Bayer2014-08-201-2/+107
| | | | | | | | | | | | | | | | | | | | | | | on :class:`.Insert`. This helps to fix a bug where an INSERT...FROM SELECT construct would inadvertently be compiled as "implicit returning" on supporting backends, which would cause breakage in the case of an INSERT that inserts zero rows (as implicit returning expects a row), as well as arbitrary return data in the case of an INSERT that inserts multiple rows (e.g. only the first row of many). A similar change is also applied to an INSERT..VALUES with multiple parameter sets; implicit RETURNING will no longer emit for this statement either. As both of these constructs deal with varible numbers of rows, the :attr:`.ResultProxy.inserted_primary_key` accessor does not apply. Previously, there was a documentation note that one may prefer ``inline=True`` with INSERT..FROM SELECT as some databases don't support returning and therefore can't do "implicit" returning, but there's no reason an INSERT...FROM SELECT needs implicit returning in any case. Regular explicit :meth:`.Insert.returning` should be used to return variable numbers of result rows if inserted data is needed. fixes #3169
* - update the flake8 rules againMike Bayer2014-07-181-71/+109
| | | | - apply autopep8 + manual fixes to most of test/sql/
* - Fixed bug where multi-valued :class:`.Insert` construct would failMike Bayer2014-07-141-0/+41
| | | | | | to check subsequent values entries beyond the first one given for literal SQL expressions. fixes #3069
* - Fixed bug in INSERT..FROM SELECT construct where selecting from aMike Bayer2014-05-251-1/+19
| | | | | UNION would wrap the union in an anonymous (e.g. unlabled) subquery. fixes #3044
* - Fixed bug where calling :meth:`.Insert.values` with an empty listMike Bayer2014-02-191-0/+23
| | | | | or tuple would raise an IndexError. It now produces an empty insert construct as would be the case with an empty dictionary.
* - Fixed bug with :meth:`.Insert.from_select` method where the orderMike Bayer2013-12-191-0/+29
| | | | | | | | of the given names would not be taken into account when generating the INSERT statement, thus producing a mismatch versus the column names in the given SELECT statement. Also noted that :meth:`.Insert.from_select` implies that Python-side insert defaults cannot be used, since the statement has no VALUES clause. [ticket:2895]
* - Added new method to the :func:`.insert` constructMike Bayer2013-07-051-1/+64
| | | | | | | | | | :meth:`.Insert.from_select`. Given a list of columns and a selectable, renders ``INSERT INTO (table) (columns) SELECT ..``. While this feature is highlighted as part of 0.9 it is also backported to 0.8.3. [ticket:722] - The :func:`.update`, :func:`.insert`, and :func:`.delete` constructs will now interpret ORM entities as FROM clauses to be operated upon, in the same way that select() already does. Also in 0.8.3.
* - reinstate insert returning back into test_insert.py; defaultdialectMike Bayer2013-04-011-0/+10
| | | | needs to be explicit here since tablestest sticks testing.db onto metadata.bind
* moving insert returning test back into CRUD test class until I figure out ↵Diana Clarke2013-03-301-7/+0
| | | | why moving it broke the oracle/postgres builds
* fixing tests for --db=mysql: VARCHAR requires a length on dialect mysqlDiana Clarke2013-03-301-3/+3
|
* move the insert tests from CRUDTest into sql/test_insert.py (see #2630)Diana Clarke2013-03-291-0/+309