Skip to content

Commit

Permalink
documentation for LoadDF and RunSQL class
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamSulek committed May 21, 2021
1 parent f33835c commit 748b694
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ The above code pulls data from the API to a pandas `DataFrame`.

## Loading Data to a Source

TODO
For creating SQlite database and uploading table with data (pandas DataFrame as input) use LoadDF 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")
```


## Running tests
```
Expand Down
10 changes: 10 additions & 0 deletions docs/howtos/run_sql.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Loading Data to a Source

For getting pandas DataFrame from sql query use RunSQL 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()
```
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ nav:
- "Config File": howtos/config_file.md
- Flows: howtos/flows.md
- "Get Excel file": howtos/uk_carbon_intensity.md
- "Get data as pandas DataFrame": howtos/run_sql.md
- Tutorials:
- Tutorials: tutorials/placeholder.md
- References:
Expand Down

0 comments on commit 748b694

Please sign in to comment.