Example #1
0
class OrderTable(Table):
    order_id = Col('Order ID')
    date = Col('Date Ordered')
    status = Col('Order Status')
    book = Col('Book Name')
    qty = Col('Quantity')
Example #2
0
 class MyTable(Table):
     name = Col('Subitem Name Heading', attr_list=['subi.tem.', '.nam.e'])
Example #3
0
 class MyTable(Table):
     name = Col('Subitem Name Heading', attr='subitem.name')
Example #4
0
class DynamicColsTest(ColTest):

    table_cls = create_table().add_column('name', Col('Name Heading'))
Example #5
0
 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()
Example #7
0
 class MyTable(Table):
     name = Col('Name')
     description = Col('Description')
Example #8
0
class NotesEntry_view(Table):
    item = ViewCol("", column_html_attrs={"class": "col-sm-3 text-right font-weight-bold view-table-row"})
    value = Col("")
Example #9
0
class CourseTable(Table):
    name = Col('Course name')
    instructor = Col('Instructor')
    categories = NestedTableCol('Categories', CategoryTable)
Example #10
0
class ItemTable(Table):
    name = Col('Config')
    description = Col('Value')
Example #11
0
class NotesEntry_table(StyledTable):
    id = Col("id", show=False)
Example #12
0
class MYCommentTable(Table):
    title = Col('Title')
    text = Col('Description')
    by = Col('By')
    score = Col('Score')
    mycomment = Col('My Comment')
Example #13
0
class TopItemTable(Table):
    name = Col('')
    description = Col('Qty')
Example #14
0
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"})
Example #16
0
class AssignmentTable(Table):
    name = Col('name')
    earned_points = Col('earned points')
    total_points = Col('total points')
Example #17
0
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')
Example #18
0
class CategoryTable(Table):
    name = Col('name')
    weight = Col('weight')
    assignments = NestedTableCol('assignments', AssignmentTable)
Example #19
0
 class MyTable(Table):
     table_id = 'Test table ID'
     name = Col('Name Heading')
Example #20
0
class Results(Table):
    id = Col('id', show=False)
    ranking = Col('Ranking')
    name = Col('Cuisine')
    stars = Col('Stars')
    full_address = Col('Address')
Example #21
0
 class MyTable(Table):
     name = Col('Name Heading')
     hidden = Col('Hidden', show=False)
Example #22
0
class SingleNodeTable(Table):
    descr = BoldCol("")
    value = Col("")
Example #23
0
 class MyTable(Table):
     name = Col('Name')
Example #24
0
 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')
Example #25
0
 class MyTable(Table):
     name = Col('Subitem Name Heading', attr_list=['subitem', 'name'])
class Results(Table):
    id = Col('Id', show=False)
    title = Col('Recommendation List')
Example #27
0
 class MyTable(Table):
     alt_name = Col('Name Heading', attr='name')
Example #28
0
class PrimerSet_table(StyledTable):
    id = Col("id", show=False)
    primer_set_name = StyledCol("Primer Set Name",
                                tooltip="Primer Set name or quick description")
Example #29
0
 class MyTable(Table):
     classes = ['table']
     name = Col('Name Heading')
Example #30
0
class ItemTable(Table):
    name = Col('Name')
    score = Col('Score')