def get_SQL_attributes(self, tbl: LuxSQLTable): """ Retrieves the names of variables within a specified Lux DataFrame's Postgres SQL table. Uses these variables to populate the Lux DataFrame's columns list. Parameters ---------- tbl: lux.LuxSQLTable lux.LuxSQLTable object whose columns will be populated Returns ------- None """ if "." in tbl.table_name: table_name = tbl.table_name[self.table_name.index(".") + 1 :] else: table_name = tbl.table_name attr_query = "SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = '{}'".format( table_name ) attributes = list(pandas.read_sql(attr_query, lux.config.SQLconnection)["column_name"]) for attr in attributes: tbl[attr] = None tbl._setup_done = True
def get_SQL_attributes(self, tbl: LuxSQLTable): """ Retrieves the names of variables within a specified Lux DataFrame's Postgres SQL table. Uses these variables to populate the Lux DataFrame's columns list. Parameters ---------- tbl: lux.LuxSQLTable lux.LuxSQLTable object whose columns will be populated Returns ------- None """ if "." in tbl.table_name: table_name = tbl.table_name[self.table_name.index(".") + 1 :] else: table_name = tbl.table_name attr_query = lux.config.query_templates['table_attributes_query'].format( table_name = table_name, ) attributes = list(pandas.read_sql(attr_query, lux.config.SQLconnection)["column_name"]) for attr in attributes: tbl[attr] = None tbl._setup_done = True