Can I fetch data from multiple tables from mysql?

Can I fetch data from multiple tables from mysql ?

1 Like

HI Aditi,

MindsDB is built to take one table where you specify what column you want to learn to predict given all the other columns.

As such you can surely JOIN multiple tables in Mysql and learn from that.
MindsDB can take in a pandas data frame straight in, as such you can do

from sqlalchemy import create_engine

from mindsdb import Predictor

df = pd.read_sql('SELECT * FROM table1 LEFT JOIN table2 on .....', con=create_engine('mysql+pymysql://mysql_user:mysql_password@mysql_host/mysql_db'))

my_predictor = Predictor(name='My predictor from SQL example')
predictor.learn(to_predict='column_to_predict', from_data=df)
1 Like