nodes: 0, module; 1, function_definition; 2, function_name:build_schema_info; 3, parameters; 4, block; 5, identifier:connection_alias; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, with_statement; 10, return_statement; 11, comment:"""
          Construct schema information via engine-specific queries of the tables in the DB.
  
          :return: Schema information of the following form, sorted by db_table_name.
              [
                  ("db_table_name",
                      [
                          ("db_column_name", "DbFieldType"),
                          (...),
                      ]
                  )
              ]
  
          """; 12, assignment; 13, assignment; 14, with_clause; 15, block; 16, identifier:ret; 17, identifier:connection; 18, call; 19, identifier:ret; 20, list; 21, with_item; 22, expression_statement; 23, for_statement; 24, identifier:get_valid_connection; 25, argument_list; 26, as_pattern; 27, assignment; 28, identifier:table_name; 29, identifier:tables_to_introspect; 30, block; 31, identifier:connection_alias; 32, call; 33, as_pattern_target; 34, identifier:tables_to_introspect; 35, call; 36, if_statement; 37, expression_statement; 38, expression_statement; 39, for_statement; 40, expression_statement; 41, attribute; 42, argument_list; 43, identifier:cursor; 44, attribute; 45, argument_list; 46, not_operator; 47, block; 48, assignment; 49, assignment; 50, identifier:row; 51, identifier:table_description; 52, block; 53, call; 54, identifier:connection; 55, identifier:cursor; 56, attribute; 57, identifier:table_names; 58, identifier:cursor; 59, keyword_argument; 60, call; 61, continue_statement; 62, identifier:td; 63, list; 64, identifier:table_description; 65, call; 66, expression_statement; 67, try_statement; 68, expression_statement; 69, attribute; 70, argument_list; 71, identifier:connection; 72, identifier:introspection; 73, identifier:include_views; 74, call; 75, identifier:_include_table; 76, argument_list; 77, attribute; 78, argument_list; 79, assignment; 80, block; 81, except_clause; 82, call; 83, identifier:ret; 84, identifier:append; 85, tuple; 86, identifier:_include_views; 87, argument_list; 88, identifier:table_name; 89, attribute; 90, identifier:get_table_description; 91, identifier:cursor; 92, identifier:table_name; 93, identifier:column_name; 94, subscript; 95, expression_statement; 96, as_pattern; 97, block; 98, attribute; 99, argument_list; 100, identifier:table_name; 101, identifier:td; 102, identifier:connection; 103, identifier:introspection; 104, identifier:row; 105, integer:0; 106, assignment; 107, identifier:KeyError; 108, as_pattern_target; 109, expression_statement; 110, identifier:td; 111, identifier:append; 112, tuple; 113, identifier:field_type; 114, call; 115, identifier:e; 116, assignment; 117, identifier:column_name; 118, identifier:field_type; 119, attribute; 120, argument_list; 121, identifier:field_type; 122, string; 123, attribute; 124, identifier:get_field_type; 125, subscript; 126, identifier:row; 127, string_content:Unknown; 128, identifier:connection; 129, identifier:introspection; 130, identifier:row; 131, integer:1
code: def build_schema_info(connection_alias):
      """
          Construct schema information via engine-specific queries of the tables in the DB.
  
          :return: Schema information of the following form, sorted by db_table_name.
              [
                  ("db_table_name",
                      [
                          ("db_column_name", "DbFieldType"),
                          (...),
                      ]
                  )
              ]
  
          """
      connection = get_valid_connection(connection_alias)
      ret = []
      with connection.cursor() as cursor:
          tables_to_introspect = connection.introspection.table_names(cursor, include_views=_include_views())
  
          for table_name in tables_to_introspect:
              if not _include_table(table_name):
                  continue
              td = []
              table_description = connection.introspection.get_table_description(cursor, table_name)
              for row in table_description:
                  column_name = row[0]
                  try:
                      field_type = connection.introspection.get_field_type(row[1], row)
                  except KeyError as e:
                      field_type = 'Unknown'
                  td.append((column_name, field_type))
              ret.append((table_name, td))
      return ret