MS SQL uses the wrong way to get view definition

Issue #2071 resolved
Former user created an issue
viewnames = mssql_insp.get_view_names()
for viewname in viewnames:
    vdef = mssql_insp.get_view_definition(viewname)

ends up doing: FROM INFORMATION_SCHEMA.TABLES AS TABLES_1 WHERE TABLES_1.TABLE_SCHEMA = ? AND TABLES_1.TABLE_TYPE = ? ORDER BY TABLES_1.TABLE_NAME

This is broken. Although http://msdn.microsoft.com/en-us/library/ms181381.aspx says that view definitions longer then 4000 characters will be null in fact they are truncated. Instead use sys.sql_modules to get the full view definition. As a poor man fix to this at least don't return truncated view definitions.

Note that this is with 0.6.6.

Comments (3)

  1. Mike Bayer repo owner
    • changed milestone to 0.6.7
    • changed component to mssql

    will add this to pycon sprints for the moment . Need a patch for MSDialect.get_view_definition.

  2. Log in to comment