]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- omitted 'table' and 'column' from 'from sqlalchemy import *'
authorJason Kirtland <jek@discorporate.us>
Tue, 21 Aug 2007 01:31:23 +0000 (01:31 +0000)
committerJason Kirtland <jek@discorporate.us>
Tue, 21 Aug 2007 01:31:23 +0000 (01:31 +0000)
- 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.

CHANGES
lib/sqlalchemy/__init__.py
lib/sqlalchemy/types.py
test/base/utils.py
test/dialect/mssql.py
test/dialect/oracle.py
test/orm/relationships.py
test/sql/generative.py
test/sql/query.py
test/sql/select.py
test/sql/testtypes.py

diff --git a/CHANGES b/CHANGES
index 96f44339271ac5d9fd386672cf694d7261b44c44..9974f08cf3f57a11c8507b9ec72b4b983ce83966 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -5,6 +5,20 @@ CHANGES
 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.
 
@@ -1292,7 +1306,7 @@ CHANGES
 - 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
index bdd3604de9801a5b0074253b453e32cdb1b98c40..601d36b7bbb20fb7442f826553978b9d5b3a7254 100644 (file)
@@ -4,9 +4,27 @@
 # 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
 
 
index 0b3253420dc07b5c5a0cf552ae707fdd9c5413f6..833d2cf1595d88f7a483f46ff20145fa8ed92f0f 100644 (file)
@@ -4,11 +4,13 @@
 # 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
index 97f3db06fcd871b50373239ad8a2f4d0c3fda406..8df3a2b97dd6919bf64e8695668d0bd5b669dfa4 100644 (file)
@@ -1,5 +1,5 @@
 import testbase
-from sqlalchemy import util, column, sql, exceptions
+from sqlalchemy import util, sql, exceptions
 from testlib import *
 
 
@@ -37,9 +37,9 @@ class OrderedDictTest(PersistTest):
 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
 
@@ -53,9 +53,9 @@ class ColumnCollectionTest(PersistTest):
         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)
index 781f27029f1d38106d600f55974b386eb9c84c21..eeadde2ffd60bc7aba183ea75e6062b723714213 100755 (executable)
@@ -1,6 +1,7 @@
 import testbase
 import re
 from sqlalchemy import *
+from sqlalchemy.sql import table, column
 from sqlalchemy.databases import mssql
 from testlib import *
 
index 9f194bf070bfb8cdb0975287ca94b99fc1c0a122..a717a7338f5afc7fd1bb09f8aad4c147997a9751 100644 (file)
@@ -1,5 +1,6 @@
 import testbase
 from sqlalchemy import *
+from sqlalchemy.sql import table, column
 from sqlalchemy.databases import oracle
 
 from testlib import *
index 305cdb608298452f57fec532acbd400f1632a845..e628b20b58177fc7a2a4b60579f7501e62cf5ed1 100644 (file)
@@ -1,6 +1,7 @@
 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
@@ -674,7 +675,7 @@ class TypedAssociationTable(ORMTest):
     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
index 9bd97b3054b45b05df7ef6bd8761353f7ddcfc47..ece8a8d055ba849aab1ba5668ca50061c660c860 100644 (file)
@@ -1,5 +1,6 @@
 import testbase
 from sqlalchemy import *
+from sqlalchemy.sql import table, column, ClauseElement
 from testlib import *
 from sqlalchemy.sql.visitors import *
 
index ddd5348c4521f8f0fe8a97f95e2edcedddc33fb4..4e68fb980b9d22da48835cd270f6e1ccce2d6250 100644 (file)
@@ -1,7 +1,7 @@
 import testbase
 import datetime
 from sqlalchemy import *
-from sqlalchemy import exceptions
+from sqlalchemy import exceptions, sql
 from sqlalchemy.engine import default
 from testlib import *
 
@@ -397,7 +397,7 @@ class QueryTest(PersistTest):
         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()
         
index c075d4e3b462fd20bdc3c85c7d3fa9a1b151d125..2d3f579547fd083adaebc8f686632b834634728e 100644 (file)
@@ -2,6 +2,7 @@ import testbase
 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 *
 
index e355436ec147a39187fa0894e7749cdd8a6ce23c..f4a9d3c7030ea4559a43dcab121134dfb9bade85 100644 (file)
@@ -188,7 +188,7 @@ class ColumnsTest(AssertMixin):
         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)),