Commit Graph

149 Commits

Author SHA1 Message Date
Mike Bayer 28b86bcd4f - fix to oracle table aliasing
- added select.prefix_with(), adds arbitrary prefixes to a SELECT's columns clause, [ticket:504]
2007-07-26 17:37:30 +00:00
Mike Bayer 778cb994f5 - ANSICompiler now uses its own traversal when compiling, returning a composed
string from each visit_XXXX method, so that the full string is compiled at once
without using any dictionary storage.  dialects modified accordingly.
tested on mysql/sqlite/postgres fully,
tested with string-only tests for oracle/fb/informix/mssql so far.
2007-07-26 07:19:37 +00:00
Mike Bayer 851524aa59 renamed new scalar() method to as_scalar(), not deprecating normal ClauseElement.scalar()... 2007-07-24 20:18:32 +00:00
Mike Bayer 0f7e7c3a6e - deprecated scalar=True argument on select(). its replaced
by select().scalar() which returns a _ScalarSelect object, that obeys
the ColumnElement interface fully
- removed _selectable() method.  replaced with __selectable__() as an optional
duck-typer; subclassing Selectable (without any __selectable__()) is equivalent
- query._col_aggregate() was assuming bound metadata.  ick !
- probably should deprecate ClauseElement.scalar(), in favor of ClauseElement.execute().scalar()...
otherwise might need to rename select().scalar()
2007-07-24 20:05:10 +00:00
Mike Bayer 782e578a41 - Numeric and Float types now have an "asdecimal" flag; defaults to
True for Numeric, False for Float.  when True, values are returned as
decimal.Decimal objects; when False, values are returned as float().
the defaults of True/False are already the behavior for PG and MySQL's
DBAPI modules. [ticket:646]
2007-07-24 16:36:14 +00:00
Mike Bayer 0a4d9f9a8f ColumnDefault functions pass ExecutionContext to callables which accept a single argument;
refactored workings of defaults so that they share the same execution context.
2007-07-23 20:56:27 +00:00
Mike Bayer a9d93d7467 - refinement of connection.execute() , parameter processing behavior
- Connection's dealings with params are simplified; generation of
ClauseParameters pushed into DefaultDialect.
- simplified ClauseParameters.
- this is to make room for execute_raw() but I haven't decided how that
should look yet.
2007-07-23 15:52:09 +00:00
Jason Kirtland 0296f9c412 Refactored test support code, moved most into 'testlib/'
Cleaned up imports, all tests should be runnable stand-alone or suite now
Updated most of the perf tests
Removed dead test suites
Added new profiling decorator
Added new profilable perf test, 'ormsession' to try to capture a typical workload
2007-07-23 01:50:54 +00:00
Mike Bayer 0c7a116971 - fix to _CalculatedClause._copy_internals() behavior so that ClauseAdapter works with _Function objects better
- factored AliasedClauses out of EagerLoader into its own unit; Query makes heavy use of it for joins
- added support to Query for full interaction between aliased and nonalised joins with appended entities, columns, and externally-mapped columns
2007-07-22 19:35:46 +00:00
Mike Bayer e9da3425e4 - changed set used to generate FROM list to an ordered set; may fix [ticket:669]
- improvements to select generative capability, ClauseAdapter
- one select test is failing, but not from this checkin
2007-07-19 20:36:51 +00:00
Mike Bayer 95d2771c6f - all "type" keyword arguments, such as those to bindparam(), column(),
Column(), and func.<something>(), renamed to "type_".  those objects
  still name their "type" attribute as "type".
- new SQL operator implementation which removes all hardcoded operators
  from expression structures and moves them into compilation;
  allows greater flexibility of operator compilation; for example, "+"
  compiles to "||" when used in a string context, or "concat(a,b)" on
  MySQL; whereas in a numeric context it compiles to "+".  fixes [ticket:475].
- major cruft cleanup in ANSICompiler regarding its processing of update/insert
  bind parameters.  code is actually readable !
- a clause element embedded in an UPDATE, i.e. for a correlated update, uses
  standard "grouping" rules now to place parenthesis.  Doesn't change much, except
  if you embed a text() clause in there, it will not be automatically parenthesized
  (place parens in the text() manually).
2007-07-19 07:11:55 +00:00
Paul Johnston aa299318a9 Properly escape table names when reflecting for mssql and sqlite [ticket:653] 2007-07-17 22:32:16 +00:00
Jason Kirtland b58097dfde - Adjust has_table for MySQL, workaround multibyte issue on osx 2007-07-17 06:22:58 +00:00
Mike Bayer 9ff169028d - moved query._with_parent into prop.compare() calls
- built extensible operator framework in sql package, ORM
builds on top of it to shuttle python operator objects back down
to the individual columns.  no relation() comparisons yet.  implements
half of [ticket:643]
2007-07-17 01:14:33 +00:00
Jason Kirtland 1978553803 When testing unicode for MySQL, ensure the connection is utf8 2007-07-16 21:23:51 +00:00
Mike Bayer be68a8e306 - converted all anonymous labels and aliases to be generated within the compilation phase. this allows fully "deterministic" label generation. theres a couple of unit test failures that need to be fixed but most are passing.
- also some tweaks to unicode result column names; no longer chopping out characters from the names, since the name might be composed of all non-ascii characters.  mysql needs some work here since its returning, i think, the unicode's internally-encoded bytes directly within a bytestring.
- need to simplify the amount of dictionaries present in ANSICompiler, its pretty hard to follow at this point.
2007-07-16 18:55:05 +00:00
Mike Bayer 96e3d6b64f merged trunk r2901-2924 2007-07-16 16:06:16 +00:00
Mike Bayer 13e1cf09c6 - bind test in query.orm
- merged ambiguous colname fix from r2915
2007-07-15 15:42:47 +00:00
Mike Bayer 60f60b9a60 - merged trunk r2880-r2901 (slightly manually for 2900-2901)
- merges "bind" argument change
- merges join fixes for [ticket:185]
- removed all "engine"/"connectable"/"bind_to"/"engine_or_url" arguments/attributes
2007-07-14 23:36:17 +00:00
Mike Bayer 58662f502b merged trunk r2826-2879 2007-07-12 00:55:18 +00:00
Jason Kirtland 1a07f1aaee Try to only convert :bind params and leave colons in text literals alone 2007-07-10 21:53:03 +00:00
Jason Kirtland 472fa072a6 - renamed DynamicMetaData to ThreadLocalMetaData
- removed BoundMetaData, use MetaData instead
2007-07-06 00:55:41 +00:00
Mike Bayer b0b5e9f2e3 moved oracles "auto_convert_lobs" logic into a generic dialect
function which attempts to map DBAPI types to TypeEngine instances
at result time.  This only occurs for statements that have no typemaps
(i.e. textual statements).
2007-07-01 19:19:56 +00:00
Mike Bayer c9e31751ed marking some methods as private 2007-07-01 18:27:08 +00:00
Mike Bayer 7fcaa67294 merged postgres domains patch r2814-2815 2007-06-30 00:01:54 +00:00
Mike Bayer e94baeaacd some comparison fixes 2007-06-28 18:25:39 +00:00
Ants Aasma 8b89aa795c merge compound select grouping patch from trunk (ticket #623) 2007-06-26 18:31:57 +00:00
Ants Aasma c533030643 merge from trunk #624 fix, modulo operator escaping 2007-06-26 16:38:16 +00:00
Ants Aasma 73b76e57ac merged between precedence from trunk ([2785]) 2007-06-25 19:20:53 +00:00
Mike Bayer 9225b3dee9 merged operator precedence fixes/tests IN fixes/tests from trunk r2782-r2783 2007-06-25 17:22:14 +00:00
Mike Bayer 0e209828b5 moved "clone" conditional blocks into separate copy_internals() method; was a
conflation of tasks having them in the same place like that.
2007-06-25 03:14:01 +00:00
Mike Bayer 11b0fdc1b6 merged trunk r2755-r2778 2007-06-24 20:09:54 +00:00
Mike Bayer 13ac46eb3f - merge of generative_sql branch
- copy_container() removed.  ClauseVisitor.traverse() now features "clone"
flag which allows traversal with copy-and-modify-in-place behavior
- select() objects copyable now [ticket:52] [ticket:569]
- improved support for custom column_property() attributes which
  feature correlated subqueries...work better with eager loading now.
- accept_visitor()  methods removed.  ClauseVisitor now genererates method
names based on class names, or an optional __visit_name__ attribute.  calls
regular visit_XXX methods as they exist, can optionally call an additional
"pre-descent" enter_XXX method to allow stack-based operations on traversals
- select() and union()'s now have "generative" behavior.  methods like
order_by() and group_by() return a *new* instance - the original instance
is left unchanged.  non-generative methods remain as well.
- the internals of select/union vastly simplified - all decision making
regarding "is subquery" and "correlation" pushed to SQL generation phase.
select() elements are now *never* mutated by their enclosing containers
or by any dialect's compilation process
2007-06-24 19:58:41 +00:00
Mike Bayer a0f01fc86c - merged trunk r2730-r2755
- removed "clear_mapper()" method
2007-06-20 22:53:03 +00:00
Mike Bayer 37762aad5c - merged last_inserted_ids() fix from trunk [changeset:2743] 2007-06-17 00:57:06 +00:00
Jason Kirtland 5b779d30c3 - Added testbase.Table and testbase.Column, interceptors that can set up
test-run- and dialect-specific options on those objects
  All tests re-pointed to go through the interceptors
- Removed mysql_engine= from table declarations, replaced with a general
  flag indicating storage requirements
- Added ability to choose a global MySQL storage engine for all tests
  --mysql-engine=<whatever>
  If none is specified, tests use the old db-default/InnoDB behavior
- Added ability to append arbitrary table creation params
  --table-option=KEY=VALUE
  For MySQL 3, use this to set mysql_type instead of --mysql-engine
- Removed a couple dead test modules
2007-06-15 22:35:53 +00:00
Mike Bayer 4b3af119f7 - added "explcit" create/drop/execute support for sequences
(i.e. you can pass a "connectable" to each of those methods
on Sequence)
- checkfirst flag propigates for sequence creates/drops
2007-06-15 16:51:25 +00:00
Mike Bayer 47c3ce38aa - merged trunk 2629-2730
- fixes to is_select() which is now an important method
- mysql unit tests fixes
2007-06-14 18:37:20 +00:00
Mike Bayer 6b293a78d3 - MetaData loses 'name' attribute
- no more global_connect()
2007-06-11 19:48:36 +00:00
Mike Bayer ce2d1c7159 added separate test for metadata
some cleanup to query.py unit test
added settable "engine" property on MetaData
2007-06-11 19:31:19 +00:00
Mike Bayer 5430c7177a - fixed bug where selectable.corresponding_column(selectable.c.col)
would not return selectable.c.col, if the selectable is a join
of a table and another join involving the same table.  messed
up ORM decision making [ticket:593]
- removed is_natural_case function from ANSIIdentifierPreparer
2007-06-06 23:39:25 +00:00
Mike Bayer 9b61ea39a8 - moved another chunk of mapper.py tests to query.py test suite
- got all tests/extensions working with new APIs
- axed proxyengine until further notice
- SelectResults folds into a 10 line wrapper for Query, loses join_to() (use join())
- test cleanup
2007-06-05 23:12:03 +00:00
Mike Bayer 5c31a8c5e9 - merged trunk r2653
- small orm fixes
2007-05-26 20:10:06 +00:00
Mike Bayer 9102d678ab - removed "no group by's in a select thats part of a UNION"
restriction [ticket:578]
2007-05-18 19:01:47 +00:00
Mike Bayer 1848439d44 restored outerjoin test 2007-05-15 16:51:40 +00:00
Mike Bayer ae4b954b1a - parenthesis are applied to clauses via a new _Grouping construct.
uses operator precedence to more intelligently apply parenthesis
to clauses, provides cleaner nesting of clauses (doesnt mutate
clauses placed in other clauses, i.e. no 'parens' flag)
- added 'modifier' keyword, works like func.<foo> except does not
add parenthesis.  e.g. select([modifier.DISTINCT(...)]) etc.
2007-05-14 22:25:36 +00:00
Mike Bayer 3de128138a - _Label propigates "_hide_froms()" so that scalar selects
behave more properly with regards to FROM clause #574
2007-05-11 00:21:29 +00:00
Mike Bayer e23c3a8974 - fix to long name generation when using oid_column as an order by
(oids used heavily in mapper queries)
2007-05-07 20:29:26 +00:00
Mike Bayer 752ef2802c - _Label class overrides compare_self to return its ultimate object.
meaning, if you say someexpr.label('foo') == 5, it produces
the correct "someexpr == 5".
2007-05-03 22:31:52 +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