1

I’m trying to explore some data we have in a MariaDB database, and after I set up my environment, I tried to install taipy[mysql] as recommended in the manual.

At this step, I get a warning :

WARNING: taipy 2.0.0 does not provide the extra ‘MySQL’

My pipeline fails with an error : taipy.core.exceptions.exceptions.UnknownDatabaseEngine: Unknown engine: mysql

My Node Config is defined as:

products_cfg = Config.configure_sql_data_node(
id=’products’,
db_username=’xxxxxx’,
db_password=’XxxxxxxxxX’,
db_name=’db’,
db_engine=’mysql’,
db_port=3306,
read_query=get_products_query(),
write_query_builder=write_query_builder,
scope=Scope.GLOBAL
)

Is there a way to use MySQL/MariaDB directly, or do I have to pull data in some intermediate format like CSV or JSON and adapt my pipe?

Thank you for your help,

Best regards

Shadow
  • 33,525
  • 10
  • 51
  • 64
  • The `taipy` tag has no description and the `mysql` tag alone is not enough for your question (I know a bit about Mysql, but nothing about Node libraries). Please, add "broader" tags to reach to more people. – Jetto Martínez May 12 '23 at 20:46
  • Based on the error message I would venture you need to install and configure some kind of a mysql or mariadb driver. I have no idea what taipy is or how that works, but surey it has some kind of a documentation describing how to make database connections. Btw, if there is a mariadb driver, then I would use that instead of a mysql one. – Shadow May 13 '23 at 00:40
  • Yep, there is documentation, see https://docs.taipy.io/en/latest/manuals/core/config/data-node-config/#sql-table – Shadow May 13 '23 at 00:44
  • Please [edit] your question title to describe the problem you're having or question you're asking. Your current title is nothing but a useless repetition of the tags, which should not be in the title at all. The title should be clear and descriptive enough that a future site user who is skimming a list of search results will understand what it's about. For some suggestions about writing a good title, see [ask]. – Ken White May 13 '23 at 03:27

1 Answers1

1

Taipy 2.0 didn't support MySQL. Taipy 2.2 should now support it.

However, you can use the Generic Data Node if you ever need to integrate a specific Data Source like MariaDB or others.

It is a Data Node where a write and read function has to be provided. You can then use it in Taipy as a regular Data Node.

In the code below,the Generic Data Node can read and write a CSV. The same can be done for any data sources.

from taipy.core import Config

def read_data(path):
    return pd.read_csv(path)

def write_data(data, path):
    pd.DataFrame(data).to_csv(path)

generic_data_node_cfg = Config.configure_generic_data_node(id="my_data_node",
                                                           read_fct=read_data,
                                                          write_fct=write_data,
                                                          read_fct_params=("res.csv"),
                                                          write_fct_params=("res.csv"))

You also have to be aware of your types. The function of your task will receive the type given by read_data. The type returned by your task function should be correct for write_data to work.

In other words, this line of code below should work with "foo" and "bar" optional and function(), your normal Python function used by your task.

write_data(function(read_data("foo")), "bar")
Florian Jacta
  • 1,143
  • 1
  • 2
  • 5