From 1f45ce1e310a62a6bd8d22df9b98186e34e6e256 Mon Sep 17 00:00:00 2001 From: AdamSulek Date: Mon, 24 May 2021 14:16:51 +0200 Subject: [PATCH] renaming in docs and test with Insert task --- README.md | 8 ++++---- docs/howtos/run_sql.md | 8 ++++---- tests/prefect/test_tasks_sqlite.py | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 3fb244cde..a813642b8 100644 --- a/README.md +++ b/README.md @@ -30,12 +30,12 @@ The above code pulls data from the API to a pandas `DataFrame`. ## Loading Data to a Source -For creating SQlite database and uploading table with data (pandas DataFrame as input) use LoadDF class. +For creating SQlite database and uploading table with data (pandas DataFrame as input) use Insert class. ```python -from viadot.tasks.sqlite_tasks import LoadDF -table = LoadDF() -table.run(table_name=TABLE_NAME, dtypes=dtypes, db_path=database_path, df=df, if_exists="replace") +from viadot.tasks.sqlite_tasks import Insert +insert = Insert() +insert.run(table_name=TABLE_NAME, dtypes=dtypes, db_path=database_path, df=df, if_exists="replace") ``` diff --git a/docs/howtos/run_sql.md b/docs/howtos/run_sql.md index 6ac44abe8..7beaefe31 100644 --- a/docs/howtos/run_sql.md +++ b/docs/howtos/run_sql.md @@ -1,10 +1,10 @@ ## Loading Data to a Source -For getting pandas DataFrame from sql query use RunSQL class. +For getting pandas DataFrame from sql query use SQLtoDF class. Get path to database and sql file as an arguments. ```python -from viadot.tasks.sqlite_tasks import RunSQL -runsql = RunSQL(db_path=database_path, sql_path=sql_path) -df_from_task = runsql.run() +from viadot.tasks.sqlite_tasks import SQLtoDF +sql = SQLtoDF(db_path=database_path, sql_path=sql_path) +df_from_task = sql.run() ``` diff --git a/tests/prefect/test_tasks_sqlite.py b/tests/prefect/test_tasks_sqlite.py index db9a21c8b..4c90fee25 100644 --- a/tests/prefect/test_tasks_sqlite.py +++ b/tests/prefect/test_tasks_sqlite.py @@ -15,7 +15,7 @@ def load_table(): def test_create_table_from_df(load_table): dtypes = {"country": "VARCHAR(100)", "sales": "FLOAT(24)"} - data = pd.DataFrame({"country": 'italy', "sales": 100.}) + df_data = pd.DataFrame({"country": ['italy'], "sales": [100.]}) load = load_table.run(table_name=TABLE, schema=None, dtypes=dtypes,