class OrderTable(Table): order_id = Col('Order ID') date = Col('Date Ordered') status = Col('Order Status') book = Col('Book Name') qty = Col('Quantity')
class MyTable(Table): name = Col('Subitem Name Heading', attr_list=['subi.tem.', '.nam.e'])
class MyTable(Table): name = Col('Subitem Name Heading', attr='subitem.name')
class DynamicColsTest(ColTest): table_cls = create_table().add_column('name', Col('Name Heading'))
class MyTable(Table): get_name = Col('Name Heading')
def main(): global choice, current_choice, load_startup, pk_value_dict, columns_dict_keys, where_condition, table_desc, column_names, columns_desc conn = None cursor = None try: params = request.values db_name = params.get('db_name') app.config['MYSQL_DATABASE_DB'] = (db_name if db_name else app.config['MYSQL_DATABASE_DB']) if params.get('table_menu'): choice = params.get('table_menu') conn = mysql.connect() cursor = conn.cursor(pymysql.cursors.DictCursor) table_list = [] cursor.execute('SHOW TABLES') rows = cursor.fetchall() for (table_name) in rows: table_list.append(table_name['Tables_in_' + app.config['MYSQL_DATABASE_DB']]) if params.get('table_menu'): cursor.execute('SELECT * FROM ' + choice) rows = cursor.fetchall() if not rows: return jsonify("No records found") tablecls = create_table('tablecls') columns_dict_keys = rows[0].keys() for header in rows[0].keys(): tablecls.add_column(header, Col(header)) cursor.execute("select sta.column_name as pk_name from information_schema.statistics " + \ "as sta WHERE sta.table_name = '" + choice + "' AND sta.index_name = 'PRIMARY';") pkey_rows = cursor.fetchall() cursor.execute('DESC ' + choice) columns_desc = cursor.fetchall() pk_value_dict = {} for pkvalue in pkey_rows: pk_value_dict[pkvalue['pk_name']] = pkvalue['pk_name'] if pk_value_dict == {}: for header in rows[0].keys(): tablecls.add_column(header, Col(header)) pk_value_dict[header] = header table_desc = [None] * 7 for i in range(len(cursor.description)): table_desc[i] = cursor.description[i] tablecls.add_column( 'Edit', ButtonCol('Edit', 'edit_view_generic', url_kwargs=pk_value_dict)) tablecls.add_column( 'Delete', ButtonCol('Delete', 'delete_user', url_kwargs=pk_value_dict)) tablecls.border = True table = tablecls(rows) if load_startup == "yes": load_startup = '' return render_template("index.html", table=table) else: return jsonify(table) else: table = "<table></table>" return render_template("index.html", table=table) except Exception as e: print(e) err_lineno = str(traceback.format_exc()).split(",")[1] print(err_lineno) finally: cursor.close() conn.close()
class MyTable(Table): name = Col('Name') description = Col('Description')
class NotesEntry_view(Table): item = ViewCol("", column_html_attrs={"class": "col-sm-3 text-right font-weight-bold view-table-row"}) value = Col("")
class CourseTable(Table): name = Col('Course name') instructor = Col('Instructor') categories = NestedTableCol('Categories', CategoryTable)
class ItemTable(Table): name = Col('Config') description = Col('Value')
class NotesEntry_table(StyledTable): id = Col("id", show=False)
class MYCommentTable(Table): title = Col('Title') text = Col('Description') by = Col('By') score = Col('Score') mycomment = Col('My Comment')
class TopItemTable(Table): name = Col('') description = Col('Qty')
class CartTable(Table): ISBN = Col('ISBN') book = Col('Book Name') qty = Col('Quantity')
class TestTable(BaseTable): id = Col("ID") name = Col("Name") something = Col("Something") created = Col("Created") edit = LinkCol("Edit", f".edit_model", url_kwargs={"id": "id"})
class AssignmentTable(Table): name = Col('name') earned_points = Col('earned points') total_points = Col('total points')
class ItemTable(Table): date_and_time = Col('date_and_time') event_type = Col('event_type') file_path = Col('file_path') is_directory = Col('is_directory')
class CategoryTable(Table): name = Col('name') weight = Col('weight') assignments = NestedTableCol('assignments', AssignmentTable)
class MyTable(Table): table_id = 'Test table ID' name = Col('Name Heading')
class Results(Table): id = Col('id', show=False) ranking = Col('Ranking') name = Col('Cuisine') stars = Col('Stars') full_address = Col('Address')
class MyTable(Table): name = Col('Name Heading') hidden = Col('Hidden', show=False)
class SingleNodeTable(Table): descr = BoldCol("") value = Col("")
class MyTable(Table): name = Col('Name')
class ItemTable(Table): # id = Col('ID') time = Col('Timestamp') machine = Col('System ID') tote1level = Col('Tote 1 Level') tote2level = Col('Tote 2 Level') tote3level = Col('Tote 3 Level') tote4level = Col('Tote 4 Level') tote5level = Col('Tote 5 Level') tote6level = Col('Tote 6 Level') tote1tally = Col('Tote 1 Count') tote2tally = Col('Tote 2 Count') tote3tally = Col('Tote 3 Count') tote4tally = Col('Tote 4 Count') tote5tally = Col('Tote 5 Count') tote6tally = Col('Tote 6 Count')
class MyTable(Table): name = Col('Subitem Name Heading', attr_list=['subitem', 'name'])
class Results(Table): id = Col('Id', show=False) title = Col('Recommendation List')
class MyTable(Table): alt_name = Col('Name Heading', attr='name')
class PrimerSet_table(StyledTable): id = Col("id", show=False) primer_set_name = StyledCol("Primer Set Name", tooltip="Primer Set name or quick description")
class MyTable(Table): classes = ['table'] name = Col('Name Heading')
class ItemTable(Table): name = Col('Name') score = Col('Score')