mysql/funcs/crud_mysql.py
def insert():
    """Insert new item in table."""
    connection = connect()
    cursor = connection.cursor()
    name = input('Enter product name: ')
    price = input('Enter product price: ')
    stock = input('Enter product stock: ')
    cursor.execute(f"INSERT INTO produtos" \
                   f"(nome, preco, estoque) VALUES " \
                   f"('{name}', {price}, {stock})")
    check_operation(connection, cursor)
    disconnect(connection)
Insert new item in table.
Insert new item in table.
Insert new item in table .
def insert():
    connection = connect()
    cursor = connection.cursor()
    name = input('Enter product name: ')
    price = input('Enter product price: ')
    stock = input('Enter product stock: ')
    cursor.execute(f"INSERT INTO produtos" \
                   f"(nome, preco, estoque) VALUES " \
                   f"('{name}', {price}, {stock})")
    check_operation(connection, cursor)
    disconnect(connection)
def insert ( ) : connection = connect ( ) cursor = connection . cursor ( ) name = input ( 'Enter product name: ' ) price = input ( 'Enter product price: ' ) stock = input ( 'Enter product stock: ' ) cursor . execute ( f"INSERT INTO produtos" f"(nome, preco, estoque) VALUES " f"('{name}', {price}, {stock})" ) check_operation ( connection , cursor ) disconnect ( connection )
Insert new item in table.
Insert new item in table .
"""Insert new item in table."""