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