Esempio n. 1
0
 def refresh(self, schema):
     for table in self.driver.execute_raw(SQL_TABLES):
         if table[1] == 'table':
             klass = dbo.Table
         else:
             klass = dbo.View
         t = klass(table[0], table[0])
         schema.add_object(t)
         for col in self.driver.execute_raw(('pragma table_info'
                                             '(\'{}\')').format(table[0])):
             uid = '{}#{}'.format(table[0], col[1])
             col = dbo.Column(uid, col[1], order=col[0])
             t.add_column(col)
Esempio n. 2
0
 def refresh(self, schema):
     tables = {}
     for item in self.driver.execute_raw(SQL_TABLES):
         if item[3] == 'r':
             klass = dbo.Table
         else:
             klass = dbo.View
         t = klass(item[0], item[1], item[2])
         schema.add_object(t)
         tables[item[0]] = t
     for col in self.driver.execute_raw(SQL_COLUMNS):
         table = tables[col[0]]
         col = dbo.Column(col[1], col[2], description=col[3], order=col[4])
         table.add_column(col)
Esempio n. 3
0
 def refresh(self, schema):
     tables = {}
     for item in self.driver.execute_raw(SQL_TABLES).fetchall():
         if item[1] == 't':
             klass = dbo.Table
         else:
             klass = dbo.View
         t = klass(item[0], item[0])
         schema.add_object(t)
         tables[t.uid] = t
     for col in self.driver.execute_raw(SQL_COLUMNS):
         table = tables[col[0]]
         uid = '{}#{}'.format(col[0], col[1])
         col = dbo.Column(uid, col[1], order=col[2])
         table.add_column(col)
Esempio n. 4
0
 def refresh(self, schema):
     tables = {}
     sql = SQL_TABLES % {'schema': self.driver.config['db']}
     for item in self.driver.execute_raw(sql):
         uid = '{}.{}'.format(item[0], item[1])
         if item[3] == 't':
             klass = dbo.Table
         else:
             klass = dbo.View
         t = klass(uid, item[1], item[2])
         schema.add_object(t)
         tables[uid] = t
     sql = SQL_COLUMNS % {'schema': self.driver.config['db']}
     for col in self.driver.execute_raw(sql):
         table_uid = '{}.{}'.format(col[0], col[1])
         table = tables[table_uid]
         col_uid = '{}.{}'.format(table_uid, col[2])
         col = dbo.Column(col_uid, col[2], description=col[4], order=col[3])
         table.add_column(col)