code: def extend_relations(self, data, kind):
          
          # 'data' is a generator object. It can throw an exception while being
          # consumed. This could happen if the user has launched the app without
          # specifying a database name. This exception must be handled to prevent
          # crashing.
          try:
              data = [self.escaped_names(d) for d in data]
          except Exception:
              data = []
  
          # dbmetadata['tables'][$schema_name][$table_name] should be a list of
          # column names. Default to an asterisk
          metadata = self.dbmetadata[kind]
          for relname in data:
              try:
                  metadata[self.dbname][relname[0]] = ['*']
              except KeyError:
                  _logger.error('%r %r listed in unrecognized schema %r',
                                kind, relname[0], self.dbname)
              self.all_completions.add(relname[0])
docs: Extend metadata for tables or views
          :param data: list of (rel_name, ) tuples
          :param kind: either 'tables' or 'views'
          :return: