Schema AI Assist
Overview
Traditionally, creating a database schema involves a detailed analysis of business requirements, followed by designing tables and relationships using tools and languages like SQL. This process can be time-consuming, complex, and prone to human error. Now, you can leverage the power of artificial intelligence to automate and enhance the process of designing and optimizing database structures with Neurelo's AI Schema✨feature.
Neurelo's AI Schema Assist capability helps construct schemas for your application, just by specifying the intent of the application you want to build. If you already have an existing schema, it also allows you to extend and enhance your schema.
This feature significantly reduces the time and effort required to design complex database schemas and also helps adapt the schema to changing business requirements and data patterns.
This feature is supported for MongoDB, MySQL, and PostgreSQL
Using Schema AI Assist
For a New Project
To generate the schema using AI Assist for new projects, start by creating a new project. Once done, you will be presented with the option to either "Connect to a Data Source" or "Build Definitions" in your project dashboard.
Click on the "Build Schema" button under "Build Definitions." This will present you with the "Build a Schema" view.
In this view, click on the "Schema AI Assist" option. This will present you with a playground to build and iterate over your schema.
Let us say we would like to create a new schema for a "Retro CD Collection." To build this schema, you can send the following prompt in the playground: "Build a schema to store Retro CD Collection data." The database engine we will be using for this example is MongoDB.
Once the schema is generated, the playground will automatically close, and you can visualize your schema in our "Schema Builder" view. Here is an example of a schema generated by Schema AI Assist for MongoDB:
As you can observe, it generated a single object "cdCollection" with properties such as the album name, artist name, release year, genre, track list, duration, label, and the condition of the CD (mint, good, fair, etc.).
Notice also how the types are correctly aligned with what’s usually expected from such schemas.
You can also open the schema in the "ERD" view to review the schema
If you are satisfied with the first iteration, make sure to commit your changes. If you would like to further iterate over it, click on the "AI Assist" button on the top right of the "Schema" view to open up the playground again.
Let us say for the second iteration, we would like to update the “condition” property so that the options (mint, good, fair, etc.) are not of type “String” but instead should be an “Enum” with a couple of options.
To do this, you can simply use a prompt such as “Let us use an enum for the condition property.”
Et voila! The “condition” property is now an enum.
You can also ask it to create complex schemas, such as extending the existing schema to store cover art details and the CD’s physical appearance details. For instance, doing so generates the following schema (visualized using our ERD viewer):
As you can notice, it generated two “Inner Objects” (Embedded Documents in MongoDB) inside the “cdCollection” object to store the details for cover art and the CD’s physical appearance. To read more about how we support Embedded Documents, check out our tutorial on how to work with Embedded Documents and References in MongoDB.
You can also edit this schema manually using the Schema Builder, or the JSON/YAML editors. Once you have a schema you like, you can Commit the schema and use it in your environments.
For an Existing Project
Using Schema AI Assist for existing projects is similar to using it for new projects. Simply click on the “AI Assist” button in the “Schema” view under the Definitions for your project.
The Schema AI playground should pop up. You can then specify a new prompt and iterate over your existing schema.
Limitations
Please note the following when using the Schema AI Assist feature:
While it is rare, there might be cases where Schema AI Assist generates inaccuracies in certain parts of the schema. This should be immediately flagged by our “Schema Validation” functionality. Should this happen, we recommend you either:
Iterate again with Schema AI Assist over your previously working schema
Or, switch to the “JSON/YAML Editor'' and directly correct the inaccuracies in the Neurelo Schema Language (NSL). To read more about how to work with NSL, check out our guide on Neurelo Schema Language (NSL).
Note - If there are inaccuracies, before using Schema AI Assist again make sure to fix the schema first or switch back to your previous working schema before iterating again. We use the most recent schema present in the Schema definitions editor to generate a new schema
Last updated