diff options
| author | Priyansh <[email protected]> | 2021-12-09 03:01:49 -0500 |
|---|---|---|
| committer | Priyansh <[email protected]> | 2021-12-09 03:01:49 -0500 |
| commit | 3b48c04470e2c368ba18716bb789b40942d6989f (patch) | |
| tree | 1cb97d5271f2233fbf9d0ef864b91fc8a61efb17 /functions/sql_functions.py | |
| parent | 22e1d761027501bfa59b92776cf1c13eef3a0004 (diff) | |
| download | temp_pred_arima-3b48c04470e2c368ba18716bb789b40942d6989f.tar.xz temp_pred_arima-3b48c04470e2c368ba18716bb789b40942d6989f.zip | |
changed project structure
Diffstat (limited to 'functions/sql_functions.py')
| -rw-r--r-- | functions/sql_functions.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/functions/sql_functions.py b/functions/sql_functions.py new file mode 100644 index 0000000..5cc2ae9 --- /dev/null +++ b/functions/sql_functions.py @@ -0,0 +1,16 @@ +import sqlite3 as sql +import pandas as pd + + +def execute_sql_statement(sql_statement): + conn = sql.connect("database.db") + cur = conn.cursor() + cur.execute(sql_statement) + rows = cur.fetchall() + return rows + + +def run_sql_pandas(sql_statement): + conn = sql.connect("database.db") + df = pd.read_sql_query(sql_statement, conn).to_records(index=False) + return df |
