diff --git a/aula205/main.py b/aula205/main.py index 02524a0..5bccf19 100644 --- a/aula205/main.py +++ b/aula205/main.py @@ -34,15 +34,22 @@ sql = ( f'INSERT INTO {TABLE_NAME} ' '(name, weight) ' 'VALUES ' - '(?, ?)' + '(:nome, :peso)' ) # cursor.execute(sql, ['Joana', 4]) -cursor.executemany( - sql, - ( - ('Joana', 4), ('Luiz', 5) - ) -) +# cursor.executemany( +# sql, +# ( +# ('Joana', 4), ('Luiz', 5) +# ) +# ) +cursor.execute(sql, {'nome': 'Sem nome', 'peso': 3}) +cursor.executemany(sql, ( + {'nome': 'Joãozinho', 'peso': 3}, + {'nome': 'Maria', 'peso': 2}, + {'nome': 'Helena', 'peso': 4}, + {'nome': 'Joana', 'peso': 5}, +)) connection.commit() print(sql)