diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-04-03 01:35:48 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-04-03 01:35:48 +0000 |
| commit | c026339ad81dc3fc225330e9c1d383821b4e29de (patch) | |
| tree | 11042e1fb57fba1b9f4eb703de30586dd5283752 /lib | |
| parent | cc35495023e8ad6fdbb49dcc4ff0b72d6f6f1d26 (diff) | |
| download | sqlalchemy-c026339ad81dc3fc225330e9c1d383821b4e29de.tar.gz | |
merged Rick Morrison / Runar Petursson's MS-SQL module, with adjustments to alias schema-qualified Table objects
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sqlalchemy/databases/__init__.py | 2 | ||||
| -rw-r--r-- | lib/sqlalchemy/databases/information_schema.py | 12 | ||||
| -rw-r--r-- | lib/sqlalchemy/engine.py | 8 | ||||
| -rw-r--r-- | lib/sqlalchemy/schema.py | 7 |
4 files changed, 22 insertions, 7 deletions
diff --git a/lib/sqlalchemy/databases/__init__.py b/lib/sqlalchemy/databases/__init__.py index 10cf9f6b2..f009034c7 100644 --- a/lib/sqlalchemy/databases/__init__.py +++ b/lib/sqlalchemy/databases/__init__.py @@ -5,4 +5,4 @@ # the MIT License: http://www.opensource.org/licenses/mit-license.php -__all__ = ['oracle', 'postgres', 'sqlite', 'mysql']
\ No newline at end of file +__all__ = ['oracle', 'postgres', 'sqlite', 'mysql', 'mssql'] diff --git a/lib/sqlalchemy/databases/information_schema.py b/lib/sqlalchemy/databases/information_schema.py index feb3cf0c5..468e9a548 100644 --- a/lib/sqlalchemy/databases/information_schema.py +++ b/lib/sqlalchemy/databases/information_schema.py @@ -56,6 +56,18 @@ gen_key_constraints = schema.Table("key_column_usage", generic_engine, Column("constraint_name", String), schema="information_schema") +gen_ref_constraints = schema.Table("referential_constraints", generic_engine, + Column("constraint_catalog", String), + Column("constraint_schema", String), + Column("constraint_name", String), + Column("unique_constraint_catlog", String), + Column("unique_constraint_schema", String), + Column("unique_constraint_name", String), + Column("match_option", String), + Column("update_rule", String), + Column("delete_rule", String), + schema="information_schema") + class ISchema(object): def __init__(self, engine): self.engine = engine diff --git a/lib/sqlalchemy/engine.py b/lib/sqlalchemy/engine.py index 55bad6abd..727ee30ad 100644 --- a/lib/sqlalchemy/engine.py +++ b/lib/sqlalchemy/engine.py @@ -193,7 +193,7 @@ class SQLSession(object): connection = property(_connection, doc="the connection represented by this SQLSession. The connection is late-connecting, meaning the call to the connection pool only occurs when it is first called (and the pool will typically only connect the first time it is called as well)") def begin(self): - """begins" a transaction on this SQLSession's connection. repeated calls to begin() will increment a counter that must be decreased by corresponding commit() statements before an actual commit occurs. this is to provide "nested" behavior of transactions so that different functions in a particular call stack can call begin()/commit() independently of each other without knowledge of an existing transaction.""" + """begins a transaction on this SQLSession's connection. repeated calls to begin() will increment a counter that must be decreased by corresponding commit() statements before an actual commit occurs. this is to provide "nested" behavior of transactions so that different functions in a particular call stack can call begin()/commit() independently of each other without knowledge of an existing transaction. """ if self.__tcount == 0: self.__transaction = self.connection self.engine.do_begin(self.connection) @@ -506,7 +506,7 @@ class SQLEngine(schema.SchemaEngine): self.commit() def begin(self): - """"begins a transaction on the current thread's SQLSession.""" + """ begins a transaction on the current thread SQLSession. """ self.session.begin() def rollback(self): @@ -647,7 +647,7 @@ class SQLEngine(schema.SchemaEngine): return ResultProxy(cursor, self, typemap=compiled.typemap) def execute(self, statement, parameters=None, connection=None, cursor=None, echo=None, typemap=None, commit=False, return_raw=False, **kwargs): - """executes the given string-based SQL statement with the given parameters. + """ executes the given string-based SQL statement with the given parameters. The parameters can be a dictionary or a list, or a list of dictionaries or lists, depending on the paramstyle of the DBAPI. @@ -659,7 +659,7 @@ class SQLEngine(schema.SchemaEngine): up. In all error cases, a rollback() is immediately performed on the connection before - propigating the exception outwards. + propagating the exception outwards. Other options include: diff --git a/lib/sqlalchemy/schema.py b/lib/sqlalchemy/schema.py index 756c03b6e..eabfee9bb 100644 --- a/lib/sqlalchemy/schema.py +++ b/lib/sqlalchemy/schema.py @@ -256,7 +256,7 @@ class Column(sql.ColumnClause, SchemaItem): default=None : a scalar, python callable, or ClauseElement representing the "default value" for this column, which will be invoked upon insert if this column is not present in the insert list or is given a value of None. - + hidden=False : indicates this column should not be listed in the table's list of columns. Used for the "oid" column, which generally isnt in column lists. @@ -271,7 +271,9 @@ class Column(sql.ColumnClause, SchemaItem): indexed in a unique index . Pass true to autogenerate the index name. Pass a string to specify the index name. Multiple columns that specify the same index name will all be included in the index, in the - order of their creation. """ + order of their creation. + + """ name = str(name) # in case of incoming unicode super(Column, self).__init__(name, None, type) @@ -507,6 +509,7 @@ class Sequence(DefaultGenerator): """calls the visit_seauence method on the given visitor.""" return visitor.visit_sequence(self) + class Index(SchemaItem): """Represents an index of columns from a database table """ |
