sqlobject.mssql.mssqlconnection module

class sqlobject.mssql.mssqlconnection.MSSQLConnection(db, user, password='', host='localhost', port=None, autoCommit=0, **kw)[source]

Bases: DBAPI

HAS_IDENTITY = "\n       select 1\n       from INFORMATION_SCHEMA.COLUMNS\n       where TABLE_NAME = '%s'\n       and COLUMNPROPERTY(object_id(TABLE_NAME), COLUMN_NAME, 'IsIdentity') = 1\n    "
SHOW_COLUMNS = "\n        select\n                name,\n                length,\n                (       select name\n                        from systypes\n                        where cast(xusertype as int)= cast(sc.xtype as int)\n                ) datatype,\n                prec,\n                scale,\n                isnullable,\n                cdefault,\n                m.text default_text,\n                isnull(len(autoval),0) is_identity\n        from syscolumns sc\n        LEFT OUTER JOIN syscomments m on sc.cdefault = m.id\n                AND m.colid = 1\n        where\n                sc.id in (select id\n                        from sysobjects\n                where name = '%s')\n        order by\n                colorder"
SHOW_TABLES = "SELECT name FROM sysobjects WHERE type='U'"
addColumn(tableName, column)[source]
can_use_max_types()[source]
can_use_microseconds()[source]
columnsFromSchema(tableName, soClass)[source]
createColumn(soClass, col)[source]
createIDColumn(soClass)[source]
createIndexSQL(soClass, index)[source]
createReferenceConstraint(soClass, col)[source]
dbName = 'mssql'
delColumn(sqlmeta, column)[source]
guessClass(t, size, precision, scale)[source]

Here we take raw values coming out of syscolumns and map to SQLObject class types.

insert_id(conn)[source]

insert_id method.

joinSQLType(join)[source]
limit_re = re.compile('^\\s*(select )(.*)', re.IGNORECASE)
makeConnection()[source]
odbc_keywords = ('Server', 'Port', 'User Id', 'Password', 'Database')
schemes = ['mssql']
server_version()[source]

Get server version: 8 - 2000 9 - 2005 10 - 2008 11 - 2012 12 - 2014 13 - 2016

supportTransactions = True
tableExists(tableName)[source]