Created
February 20, 2019 10:55
-
-
Save rupython/609eef03f576f104a7498a86835570ee to your computer and use it in GitHub Desktop.
From: Andrey
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sqlite3 | |
connect = sqlite3.connect("some") | |
cursor = connect.cursor() | |
query = "create table example (id integer, name text);" | |
cursor.execute(query) | |
Out[10]: <sqlite3.Cursor at 0x7f62b5bb57a0> | |
cursor.fetchall() | |
Out[11]: [] | |
query = """insert into example values (1 , "Vasya");""" | |
cursor.execute(query) | |
Out[13]: <sqlite3.Cursor at 0x7f62b5bb57a0> | |
cursor.fetchall() | |
Out[14]: [] | |
query = "select * from example;" | |
cursor.fetchall() | |
Out[16]: [] | |
cursor.execute(query) | |
Out[17]: <sqlite3.Cursor at 0x7f62b5bb57a0> | |
cursor.fetchall() | |
Out[18]: [(1, 'Vasya')] | |
query = """update example set name="petya" where id =1;""" | |
cursor.execute(query) | |
Out[20]: <sqlite3.Cursor at 0x7f62b5bb57a0> | |
cursor.fetchall() | |
Out[21]: [] | |
query = "select * from example;" | |
cursor.execute(query) | |
Out[23]: <sqlite3.Cursor at 0x7f62b5bb57a0> | |
cursor.fetchall() | |
Out[24]: [(1, 'petya')] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment