Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/Core#816 - Update SQLDataNode example to run successfully #701

Merged
merged 2 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions docs/manuals/core/config/advanced-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,10 @@ the default configuration applies if some values are not provided.
import pandas as pd

def write_orders_plan(data: pd.DataFrame):
insert_data = list(
data[["date", "product_id", "number_of_products"]].itertuples(index=False, name=None))
insert_data = data[["date", "product_id", "number_of_products"]].to_dict("records")
return [
"DELETE FROM orders",
("INSERT INTO orders VALUES (?, ?, ?)", insert_data)
("INSERT INTO orders VALUES (:date, :product_id, :number_of_products)", insert_data)
]

def train(sales_history: pd.DataFrame):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
import pandas as pd

def write_query_builder(data: pd.DataFrame):
insert_data = list(
data[["date", "nb_sales"]].itertuples(index=False, name=None))
insert_data = data[["date", "nb_sales"]].to_dict("records")
return [
"DELETE FROM sales",
("INSERT INTO sales VALUES (?, ?)", insert_data)
("INSERT INTO sales VALUES (:date, :nb_sales)", insert_data)
]

sales_history_cfg = Config.configure_sql_data_node(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
import pandas as pd

def write_query_builder(data: pd.DataFrame):
insert_data = list(
data[["date", "nb_sales"]].itertuples(index=False, name=None))
insert_data = data[["date", "nb_sales"]].to_dict("records")
return [
"DELETE FROM sales",
("INSERT INTO sales VALUES (?, ?)", insert_data)
("INSERT INTO sales VALUES (:date, :nb_sales)", insert_data)
]

sales_history_cfg = Config.configure_sql_table_data_node(
sales_history_cfg = Config.configure_sql_data_node(
id="sales_history",
db_name="taipy",
db_engine="sqlite",
Expand Down
4 changes: 2 additions & 2 deletions docs/manuals/core/entities/code_example/my_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@


def write_orders_plan(data: pd.DataFrame):
insert_data = list(data[["date", "product_id", "number_of_products"]].itertuples(index=False, name=None))
return ["DELETE FROM orders", ("INSERT INTO orders VALUES (?, ?, ?)", insert_data)]
insert_data = data[["date", "product_id", "number_of_products"]].to_dict("records")
return ["DELETE FROM orders", ("INSERT INTO orders VALUES (:date, :product_id, :number_of_products)", insert_data)]


def train(sales_history: pd.DataFrame):
Expand Down
6 changes: 3 additions & 3 deletions docs/manuals/core/entities/data-node-mgt.md
Original file line number Diff line number Diff line change
Expand Up @@ -763,9 +763,9 @@ execute a list of queries returned by the query builder:
```python
data = pandas.DataFrame(
[
{"date": "01/08/2019", "product_id": 1 "number_of_products": 450},
{"date": "01/08/2019", "product_id": 3 "number_of_products": 320},
{"date": "01/08/2019", "product_id": 4 "number_of_products": 350},
{"date": "01/08/2019", "product_id": 1, "number_of_products": 450},
{"date": "01/08/2019", "product_id": 3, "number_of_products": 320},
{"date": "01/08/2019", "product_id": 4, "number_of_products": 350},
]
)

Expand Down
4 changes: 2 additions & 2 deletions docs/manuals/core/scheduling/code_example/my_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@


def write_orders_plan(data: pd.DataFrame):
insert_data = list(data[["date", "product_id", "number_of_products"]].itertuples(index=False, name=None))
return ["DELETE FROM orders", ("INSERT INTO orders VALUES (?, ?, ?)", insert_data)]
insert_data = data[["date", "product_id", "number_of_products"]].to_dict("records")
return ["DELETE FROM orders", ("INSERT INTO orders VALUES (:date, :product_id, :number_of_products)", insert_data)]


def train(sales_history: pd.DataFrame):
Expand Down
6 changes: 6 additions & 0 deletions docs/relnotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ This is the list of changes to Taipy releases as they were published.

## Significant bug fixes

<h4><strong><code>taipy-core</code></strong> 3.1.0 </h4>

- Can not write to a SQLDataNode or a SQLTableDataNode using examples provided by the
documentation.<br/>
See [issue #816](https://github.com/Avaiga/taipy-core/issues/816).


# Community edition: 3.0

Expand Down