Retrieves data (D) and names (N) from relational tables.
506824
def readTables(self):
        
        class D: pass
        cur=self.cur
        cur.execute('SELECT * FROM users')
        D.users = cur.fetchall()
        cur.execute('SELECT * FROM profiles')
        D.profiles = cur.fetchall()
        cur.execute('SELECT * FROM articles')
        D.articles = cur.fetchall()
        cur.execute('SELECT * FROM comments')
        D.comments = cur.fetchall()
        cur.execute('SELECT * FROM friendships')
        D.friendships= cur.fetchall()
        cur.execute('SELECT * FROM votes')
        D.votes= cur.fetchall()
        cur.execute('SELECT * FROM tags')
        D.tags= cur.fetchall()
        cur.execute('SELECT * FROM taggings')
        D.taggings= cur.fetchall()
        self.D=D

        class N: pass
        cur.execute("select column_name from information_schema.columns where table_name='users';")
        UN=cur.fetchall()
        N.UN=[i[0] for i in UN[::-1]]
        cur.execute("select column_name from information_schema.columns where table_name='profiles';")
        PN=cur.fetchall()
        N.PN=[i[0] for i in PN[::-1]]
        cur.execute("select column_name from information_schema.columns where table_name='articles';")
        AN=cur.fetchall()
        N.AN=[i[0] for i in AN[::-1]]
        cur.execute("select column_name from information_schema.columns where table_name='comments';")
        CN=cur.fetchall()
        N.CN=[i[0] for i in CN[::-1]]
        cur.execute("select column_name from information_schema.columns where table_name='friendships';")
        FRN=cur.fetchall()
        N.FRN=[i[0] for i in FRN[::-1]]
        cur.execute("select column_name from information_schema.columns where table_name='votes';")
        VN=cur.fetchall()
        N.VN=[i[0] for i in VN[::-1]]
        cur.execute("select column_name from information_schema.columns where table_name='tags';")
        TN=cur.fetchall()
        N.TN=[i[0] for i in TN[::-1]]
        cur.execute("select column_name from information_schema.columns where table_name='taggings';")
        TTN=cur.fetchall()
        N.TTN=[i[0] for i in TTN[::-1]]
        self.N=N
1303785
def get_tables(self, models):
        '''
        
        '''
        return { obj._meta.db_table : obj for obj in
                models.__dict__.itervalues() if
                isinstance(obj, peewee.BaseModel) and
                len(obj._meta.fields) > 1
            }
1068030
def relations_for_id(relid=None):
    """"""
    relation_data = []
    relid = relid or relation_ids()
    for unit in related_units(relid):
        unit_data = relation_for_unit(unit, relid)
        unit_data['__relid__'] = relid
        relation_data.append(unit_data)
    return relation_data
525777
def fetch_column_names(cls,
                           db: DATABASE_SUPPORTER_FWD_REF,
                           table: str) -> List[str]:
        """"""
        raise RuntimeError(_MSG_NO_FLAVOUR)
542995
def get_database_rows(self, tables=None, database=None):
        """"""
        # Get table data and columns from source database
        source = database if database else self.database
        tables = tables if tables else self.tables

        # Get database select queries
        commands = self._get_select_commands(source, tables)

        # Execute select commands
        return self._execute_select_commands(source, commands)
120529
def _get_fields(self, table_name, **kwargs):
        """"""
        ret = {}
        query_str = 'PRAGMA table_info({})'.format(self._normalize_table_name(table_name))
        fields = self._query(query_str, **kwargs)
        #pout.v([dict(d) for d in fields])

        query_str = 'PRAGMA foreign_key_list({})'.format(self._normalize_table_name(table_name))
        fks = {f["from"]: f for f in self._query(query_str, **kwargs)}
        #pout.v([dict(d) for d in fks.values()])

        pg_types = {
            "INTEGER": int,
            "BIGINT": long,
            "DOUBLE PRECISION": float,
            "FLOAT": float,
            "REAL": float,
            "NUMERIC": decimal.Decimal,
            "BOOLEAN": bool,
            "DATE": datetime.date,
            "TIMESTAMP": datetime.datetime,
            "CHARACTER": str,
            "VARCHAR": str,
            "TEXT": str,
            "BLOB": bytearray,
        }

        # the rows we can set: field_type, name, field_required, min_size, max_size,
        #   size, unique, pk, <foreign key info>
        # These keys will roughly correspond with schema.Field
        # TODO -- we could actually use "type" to get the size because SQLite returns
        # a value like VARCHAR[32]
        for row in fields:
            field = {
                "name": row["name"],
                "field_required": bool(row["notnull"]) or bool(row["pk"]),
                "pk": bool(row["pk"]),
            }

            for tname, ty in pg_types.items():
                if row["type"].startswith(tname):
                    field["field_type"] = ty
                    break

            if field["pk"] and field["field_type"] is int:
                # we compensate for SQLite internally setting pk to int
                field["field_type"] = long

            if row["name"] in fks:
                field["schema_table_name"] = fks[row["name"]]["table"]
                field["ref_table_name"] = fks[row["name"]]["table"]

            ret[field["name"]] = field

        return ret
1280266
def get_names():
    """"""
    res = list(cmaps.keys())
    res = sorted(res, key=lambda s: s.lower())
    return res
1367634
def get_data():
    

    output = []
    tables = get_tables()
    for table in tables:
        columns = get_columns(table)

        for column in columns:
            if column['name'] == 'tenant_id':
                output.append((table, column))

    return output
446345
def _get_dsnames(cls, data, ignore_keys=['attrs', 'plotter', 'ds'],
                     concat_dim=False):
        """"""
        def filter_ignores(item):
            return item[0] not in ignore_keys and isinstance(item[1], dict)
        if 'fname' in data:
            return {tuple(
                [data['fname'], data['store']] +
                ([data.get('concat_dim')] if concat_dim else []))}
        return set(chain(*map(partial(cls._get_dsnames, concat_dim=concat_dim,
                                      ignore_keys=ignore_keys),
                              dict(filter(filter_ignores,
                                          six.iteritems(data))).values())))
586320
def fetch_result_sets(cls, db, datasource_type):
        
        result_set_df = db.get_df(
            """SELECT table_schema, table_name FROM INFORMATION_SCHEMA.{}S
               ORDER BY concat(table_schema, '.', table_name)""".format(
                datasource_type.upper(),
            ),
            None)
        result_sets = []
        for unused, row in result_set_df.iterrows():
            result_sets.append('{}.{}'.format(
                row['table_schema'], row['table_name']))
        return result_sets
548537
private static void getForeignKeys(DatabaseMetaData md, DatabaseRelationDefinition relation, DBMetadata metadata) throws SQLException {

		QuotedIDFactory idfac = metadata.getQuotedIDFactory();

		RelationID relationId = relation.getID();
		try (ResultSet rs = md.getImportedKeys(null, relationId.getSchemaName(), relationId.getTableName())) {
            extractForeignKeys(relation, metadata, idfac, rs);
        }
        catch (Exception ex) {
            try (ResultSet rs = md.getImportedKeys(relationId.getSchemaName(),null, relationId.getTableName())) {
                extractForeignKeys(relation, metadata, idfac, rs);
            }
        }
	}
1185530
def get_entity_names(self, data):
        """"""
        entities = self._filter_queryset('view_entity', data.entity_set.all())
        return list(entities.values_list('name', flat=True))
144582
private static List<RelationID> getTableList(String defaultTableSchema, Set<RelationID> realTables, QuotedIDFactory idfac) throws SQLException {

		List<RelationID> fks = new LinkedList<>();
		for (RelationID table : realTables) {
			// defaultTableSchema is non-empty only for Oracle and DUAL is a special Oracle table
			if (table.hasSchema() || (defaultTableSchema == null) || table.getTableName().equals("DUAL"))
				fks.add(table);
			else {
				RelationID qualifiedTableId = idfac.createRelationID(defaultTableSchema, table.getTableNameSQLRendering());
				fks.add(qualifiedTableId);
			}
		}
		return fks;
	}
710504
def find_all(self, cls):
        """"""
        final_results = []
        for db_result in read_by_indexes(cls.get_table_name(), []):
            obj = cls.from_data(db_result['value'])
            final_results.append(obj)

        return final_results
630128
def extract_db_info(self, obj, keys):
        """"""

        objl = self.convert(obj)

        result = super(DataFrameType, self).extract_db_info(objl, keys)
        ext = self.datamodel.extractor_map['fits']
        if objl:
            with objl.open() as hdulist:
                for field in keys:
                    result[field] = ext.extract(field, hdulist)

                tags = result['tags']
                for field in self.tags_keys:
                    tags[field] = ext.extract(field, hdulist)

                return result
        else:
            return result
1082022
public List<String> getRelatedTables() throws SQLException {

		List<String> relatedTables = new ArrayList<String>();

		List<ExtendedRelation> extendedRelations = queryForAll();
		for (ExtendedRelation extendedRelation : extendedRelations) {
			relatedTables.add(extendedRelation.getRelatedTableName());
		}

		return relatedTables;
	}
622774
def getTableIDs(dbid)
      tableIDs = []
      dbid ||= @dbid
      getSchema(dbid)      
      if @chdbids
         chdbidArray = findElementsByAttributeName( @chdbids, "name" )
         chdbidArray.each{ |chdbid|
            if chdbid.has_text?
               tableIDs << chdbid.text
            end
         }
      end
      tableIDs
    end