added quant data plan
This commit is contained in:
50
01_ingest_qualtrics_export.py
Normal file
50
01_ingest_qualtrics_export.py
Normal file
@@ -0,0 +1,50 @@
|
||||
import marimo
|
||||
|
||||
__generated_with = "0.19.2"
|
||||
app = marimo.App(width="medium")
|
||||
|
||||
|
||||
@app.cell
|
||||
def _():
|
||||
import marimo as mo
|
||||
import polars as pl
|
||||
import sqlite3
|
||||
from pathlib import Path
|
||||
return Path, pl, sqlite3
|
||||
|
||||
|
||||
@app.cell
|
||||
def _(Path, pl):
|
||||
results_file = Path('./data/VB_Qualtrics_labels.csv')
|
||||
df = pl.read_csv(results_file, skip_rows=0)
|
||||
df
|
||||
return (df,)
|
||||
|
||||
|
||||
@app.cell
|
||||
def _(df, sqlite3):
|
||||
|
||||
# Create table if not exists with columns from csv
|
||||
with sqlite3.connect("data/qualtrics_JP.db") as conn:
|
||||
# interact with database
|
||||
q= f'''
|
||||
CREATE TABLE IF NOT EXISTS qualtrics_raw(
|
||||
{', '.join(list(df.columns))}
|
||||
);
|
||||
'''
|
||||
print(q)
|
||||
conn.execute(q)
|
||||
return
|
||||
|
||||
|
||||
@app.cell
|
||||
def _():
|
||||
import sqlalchemy
|
||||
|
||||
DATABASE_URL = "sqlite:///./data/qualtrics_JP.db"
|
||||
engine = sqlalchemy.create_engine(DATABASE_URL)
|
||||
return
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run()
|
||||
Reference in New Issue
Block a user