Spaces:
Sleeping
Sleeping
Download sql.py from imkhan107/Text_to_sql: direct link, hf CLI and curl.
- Browser
- Download file 975 Bytes
-
https://huggingface.co/spaces/imkhan107/Text_to_sql/resolve/main/sql.py
- Command line
-
hf download hf://spaces/imkhan107/Text_to_sql/sql.py
-
curl -L -o sql.py https://huggingface.co/spaces/imkhan107/Text_to_sql/resolve/main/sql.py
975 Bytes
| import sqlite3 | |
| ## Connectt to SQlite | |
| connection=sqlite3.connect("baradari.db") | |
| # Create a cursor object to insert record,create table | |
| cursor=connection.cursor() | |
| ## create the table | |
| table_info=""" | |
| Create table BARADARI(NAME VARCHAR(25),CLASS VARCHAR(25), | |
| SECTION VARCHAR(25),MARKS INT); | |
| """ | |
| cursor.execute(table_info) | |
| ## Insert Some more records | |
| cursor.execute('''Insert Into BARADARI values('Asif','Data Science','A',90)''') | |
| cursor.execute('''Insert Into BARADARI values('Khan','Data Science','B',100)''') | |
| cursor.execute('''Insert Into BARADARI values('Mudasir','Data Science','A',86)''') | |
| cursor.execute('''Insert Into BARADARI values('Junaid','DEVOPS','A',50)''') | |
| cursor.execute('''Insert Into BARADARI values('Dupandalaz','DEVOPS','A',35)''') | |
| ## Disspaly ALl the records | |
| print("The isnerted records are") | |
| data=cursor.execute('''Select * from BARADARI''') | |
| for row in data: | |
| print(row) | |
| ## Commit your changes int he databse | |
| connection.commit() | |
| connection.close() |