Download sequalite.py from riswanahamed/Text-sql-Generator: direct link, hf CLI and curl.
- Browser
- Download file 816 Bytes
-
https://huggingface.co/spaces/riswanahamed/Text-sql-Generator/resolve/main/sequalite.py
- Command line
-
hf download hf://spaces/riswanahamed/Text-sql-Generator/sequalite.py
-
curl -L -o sequalite.py https://huggingface.co/spaces/riswanahamed/Text-sql-Generator/resolve/main/sequalite.py
816 Bytes
| import sqlite3 | |
| connection = sqlite3.connect("test.db") | |
| cursor = connection.cursor() | |
| table_info = """ | |
| create table if not exists test(Name varchar(255), class varchar(255), | |
| section varchar(255)); | |
| """ | |
| cursor.execute(table_info) | |
| insert = """insert into test(Name, class, section) values ('riswan', 'AIDS', 'B');""" | |
| insert1 = """insert into test (Name, class, section) values ('aslam', 'AIDS', 'A');""" | |
| insert2 = """insert into test (Name,class, section) values ('ajmal', 'ECE', 'A');""" | |
| insert3 = """insert into test (Name, class, section) values ('rayan', 'ECE', 'B');""" | |
| cursor.execute(insert) | |
| cursor.execute(insert1) | |
| cursor.execute(insert2) | |
| cursor.execute(insert3) | |
| print("inserted") | |
| data = cursor.execute("SELECT * FROM test") | |
| for row in data: | |
| print(row) | |
| connection.close() |