MindsDB and SQL Alchemy
SQL Alchemy is a Python SQL toolkit, that provides object-relational mapping features for the Python programming language.
SQL Alchemy facilitates working with databases and Python. You can download it here or run a pip install sqlalchemy
.
You can consider an option to interact with MindsDB directly from MySQL CLI or Postgres CLI.
How to Connect
Please follow the instructions below to connect your MindsDB to SQL Alchemy.
You can use the Python code below to connect your MindsDB database to SQL Alchemy.
Make sure you have the pymysql module installed before executing the Python code. To install it, run the pip install pymysql
command.
Please note that we use the following connection details:
- Username is
mindsdb
- Password is left empty
- Host is
127.0.0.1
- Port is
47335
- Database name is left empty
To create a database connection, execute the code above. On success, the following output is expected:
The Sqlachemy create_engine
is lazy. This implies any human error when
entering the connection details would be undetectable until an action becomes
necessary, such as when calling the execute
method to execute SQL commands.
What’s Next?
Now that you are all set, we recommend you check out our Tutorials and Community Tutorials sections, where you’ll find various examples of regression, classification, and time series predictions with MindsDB.
To learn more about MindsDB itself, follow the guide on MindsDB database structure. Also, don’t miss out on the remaining pages from the SQL API section, as they explain a common SQL syntax with examples.
Have fun!
From Our Community
Check out the articles and video guides created by our community:
-
Article on Predict Diamond prices with SQL Alchemy by Teslim Odumuyiwa
-
Article on Predicting Home Rental Prices with MindsDB in Python by Temidayo
-
Video guide on How to connect to MindsDB with SQL Alchemy(Python) by Nishant Sapkota