Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 03_create_data_sql.py
- import sqlite3
- conn = sqlite3.connect('clientes.db')
- cursor = conn.cursor()
- # inserindo dados na tabela
- cursor.execute("""
- INSERT INTO clientes (nome, idade, cpf, email, fone, cidade, uf, criado_em)
- VALUES ('Regis', 35, '00000000000', 'regis@email.com', '11-98765-4321', 'Sao Paulo', 'SP', '2014-06-08')
- """)
- cursor.execute("""
- INSERT INTO clientes (nome, idade, cpf, email, fone, cidade, uf, criado_em)
- VALUES ('Aloisio', 87, '11111111111', 'aloisio@email.com', '98765-4322', 'Porto Alegre', 'RS', '2014-06-09')
- """)
- cursor.execute("""
- INSERT INTO clientes (nome, idade, cpf, email, fone, cidade, uf, criado_em)
- VALUES ('Bruna', 21, '22222222222', 'bruna@email.com', '21-98765-4323', 'Rio de Janeiro', 'RJ', '2014-06-09')
- """)
- cursor.execute("""
- INSERT INTO clientes (nome, idade, cpf, email, fone, cidade, uf, criado_em)
- VALUES ('Matheus', 19, '33333333333', 'matheus@email.com', '11-98765-4324', 'Campinas', 'SP', '2014-06-08')
- """)
- # gravando no bd
- conn.commit()
- print('Dados inseridos com sucesso.')
- conn.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement