0.4.0beta4
----------
+- Tidied up what ends up in your namespace when you 'from sqlalchemy import *':
+
+ - 'table' and 'column' are no longer imported. They remain available by
+ direct reference (as in 'sql.table' and 'sql.column') or a glob import
+ from the sql package. It was too easy to accidentally use a
+ sql.expressions.table instead of schema.Table when just starting out
+ with SQLAlchemy, likewise column.
+
+ - internal-ish classes like ClauseElement, FromClause, NullTypeEngine, etc.,
+ are also no longer imported into your namespace
+
+ - the 'Smallinteger' compatiblity name (small i!) is no longer imported, but
+ remains in schema.py for now. SmallInteger (big I!) is still imported.
+
- Fix to bind param processing such that "False" values (like blank strings)
still get processed/encoded.
- added example/docs for dealing with large collections
- added object_session() method to sqlalchemy namespace
- fixed QueuePool bug whereby its better able to reconnect to a database
-that was not reachable (thanks to Sébastien Lelong), also fixed dispose()
+that was not reachable (thanks to SÃ\83©bastien Lelong), also fixed dispose()
method
- patch that makes MySQL rowcount work correctly! [ticket:396]
- fix to MySQL catch of 2006/2014 errors to properly re-raise OperationalError
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
-from sqlalchemy.types import *
-from sqlalchemy.sql import *
-from sqlalchemy.schema import *
+from sqlalchemy.types import (
+ BLOB, BOOLEAN, CHAR, CLOB, DATE, DATETIME, DECIMAL, FLOAT, INT,
+ NCHAR, SMALLINT, TEXT, TIME, TIMESTAMP, VARCHAR,
+ Binary, Boolean, Date, DateTime, Float, Integer, Interval, Numeric,
+ PickleType, SmallInteger, String, Time, Unicode
+ )
+from sqlalchemy.sql import (
+ func, modifier, text, literal, literal_column, null, alias,
+ and_, or_, not_,
+ select, subquery, union, union_all, insert, update, delete,
+ join, outerjoin,
+ bindparam, outparam, asc, desc,
+ except_, except_all, exists, intersect, intersect_all,
+ between, case, cast, distinct, extract,
+ )
+from sqlalchemy.schema import (
+ MetaData, ThreadLocalMetaData, Table, Column, ForeignKey,
+ Sequence, Index, ForeignKeyConstraint, PrimaryKeyConstraint,
+ CheckConstraint, UniqueConstraint, Constraint,
+ PassiveDefault, ColumnDefault
+ )
from sqlalchemy.engine import create_engine, engine_from_config
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
-__all__ = [ 'TypeEngine', 'TypeDecorator', 'NullTypeEngine',
+__all__ = [ 'TypeEngine', 'TypeDecorator',
'INT', 'CHAR', 'VARCHAR', 'NCHAR', 'TEXT', 'FLOAT', 'DECIMAL',
- 'TIMESTAMP', 'DATETIME', 'CLOB', 'BLOB', 'BOOLEAN', 'String', 'Integer', 'SmallInteger','Smallinteger',
- 'Numeric', 'Float', 'DateTime', 'Date', 'Time', 'Binary', 'Boolean', 'Unicode', 'PickleType', 'NULLTYPE', 'NullType',
- 'SMALLINT', 'DATE', 'TIME','Interval'
+ 'TIMESTAMP', 'DATETIME', 'CLOB', 'BLOB', 'BOOLEAN',
+ 'SMALLINT', 'DATE', 'TIME',
+ 'String', 'Integer', 'SmallInteger','Smallinteger',
+ 'Numeric', 'Float', 'DateTime', 'Date', 'Time', 'Binary',
+ 'Boolean', 'Unicode', 'PickleType', 'Interval',
]
import inspect
import testbase
-from sqlalchemy import util, column, sql, exceptions
+from sqlalchemy import util, sql, exceptions
from testlib import *
class ColumnCollectionTest(PersistTest):
def test_in(self):
cc = sql.ColumnCollection()
- cc.add(column('col1'))
- cc.add(column('col2'))
- cc.add(column('col3'))
+ cc.add(sql.column('col1'))
+ cc.add(sql.column('col2'))
+ cc.add(sql.column('col3'))
assert 'col1' in cc
assert 'col2' in cc
cc1 = sql.ColumnCollection()
cc2 = sql.ColumnCollection()
cc3 = sql.ColumnCollection()
- c1 = column('col1')
+ c1 = sql.column('col1')
c2 = c1.label('col2')
- c3 = column('col3')
+ c3 = sql.column('col3')
cc1.add(c1)
cc2.add(c2)
cc3.add(c3)
import testbase
import re
from sqlalchemy import *
+from sqlalchemy.sql import table, column
from sqlalchemy.databases import mssql
from testlib import *
import testbase
from sqlalchemy import *
+from sqlalchemy.sql import table, column
from sqlalchemy.databases import oracle
from testlib import *
import testbase
import datetime
from sqlalchemy import *
+from sqlalchemy import types
from sqlalchemy.orm import *
from sqlalchemy.orm import collections
from sqlalchemy.orm.collections import collection
def define_tables(self, metadata):
global t1, t2, t3
- class MySpecialType(TypeDecorator):
+ class MySpecialType(types.TypeDecorator):
impl = String
def convert_bind_param(self, value, dialect):
return "lala" + value
import testbase
from sqlalchemy import *
+from sqlalchemy.sql import table, column, ClauseElement
from testlib import *
from sqlalchemy.sql.visitors import *
import testbase
import datetime
from sqlalchemy import *
-from sqlalchemy import exceptions
+from sqlalchemy import exceptions, sql
from sqlalchemy.engine import default
from testlib import *
w = select(['*'], from_obj=[testbase.db.func.current_date()]).scalar()
# construct a column-based FROM object out of a function, like in [ticket:172]
- s = select([column('date', type_=DateTime)], from_obj=[testbase.db.func.current_date()])
+ s = select([sql.column('date', type_=DateTime)], from_obj=[testbase.db.func.current_date()])
q = s.execute().fetchone()[s.c.date]
r = s.alias('datequery').select().scalar()
import re, operator
from sqlalchemy import *
from sqlalchemy import util
+from sqlalchemy.sql import table, column
from sqlalchemy.databases import sqlite, postgres, mysql, oracle, firebird, mssql
from testlib import *
print db.engine.__module__
testTable = Table('testColumns', MetaData(db),
Column('int_column', Integer),
- Column('smallint_column', Smallinteger),
+ Column('smallint_column', SmallInteger),
Column('varchar_column', String(20)),
Column('numeric_column', Numeric(12,3)),
Column('float_column', Float(25)),