docs/sql/project.mdx
MindsDB enables you to group all objects within projects.
Projects store all MindsDB schema objects except for handlers, connected data sources, and configured AI/ML engines. That is, projects can store models, views, jobs, triggers, agents, skills, knowledge bases, and chatbots.
MindsDB provides the default mindsdb project where all objects created without defining a project are stored.
Use the below command to create a project.
CREATE PROJECT project_name;
Use the below command to list all projects.
SHOW [FULL] DATABASES
WHERE type = 'project';
Use the below command template to create an object within a project.
CREATE <OBJECT> project_name.object_name
...;
Use the below command to remove a project.
DROP PROJECT project_name;
Let's create a project.
CREATE PROJECT my_project;
To verify that the project was created successfully, let's run the command below to select all databases, including connected data sources and projects.
SHOW FULL DATABASES;
On execution, we get:
+------------------+-------+------+
|Database |TYPE |ENGINE|
+------------------+-------+------+
|information_schema|system |[NULL]|
|mindsdb |project|[NULL]|
|my_project |project|[NULL]|
|files |data |files |
+------------------+-------+------+
Now we create a model within the project.
CREATE MODEL my_project.my_model
FROM example_db
(SELECT * FROM demo_data.home_rentals)
PREDICT rental_price;
Also, let's create a view.
CREATE VIEW my_project.my_view (
SELECT *
FROM example_db.demo_data.home_rentals
);
Here is what we have in the my_project project.
SHOW TABLES FROM my_project;
On execution, we get:
+--------------------+
|Tables_in_my_project|
+--------------------+
|my_model |
|my_view |
+--------------------+
Let's try to delete our project.
DROP PROJECT my_project;
On execution, we get:
Project 'my_project' can not be deleted, because it contains tables: my_model, my_view
Users should remove all project content before dropping a project.
DROP MODEL my_project.my_model;
DROP VIEW my_project.my_view;
Now we can proceed to drop a project.
DROP PROJECT my_project;
Below are the links to help you explore further.