AI Form Generation for SQL Tables
How to use the AI form generator in AtlasForms to automatically create a complete Atlas Form — with fields, validation rules, and SQL binding — directly from your Data Ocean table schema.
The AI Form Generation Workflow
Once you have a Data Ocean SQL table, creating the corresponding data entry form traditionally requires manually designing field layouts, writing validation rules, and wiring up SQL binding — a repetitive, time-consuming process. The AI Form Generator eliminates this by taking your SQL schema as input and producing a complete AtlasForms form definition as output.
Provide the SQL Schema
Give the AI your CREATE TABLE statement or a description of the table's columns. The AI analyzes column names, types, constraints, and nullability to understand the data shape.
AI Generates the Form Definition
The AI produces an AtlasForms form JSON definition with field controls, labels, validation rules, required flags, and field ordering — all inferred from the schema. It also generates the corresponding SQL INSERT/UPDATE commands with parameter bindings.
Review and Customize
Import the generated form into the AtlasForms Studio designer. Review the field layout, adjust labels, add any business-specific validation rules, and customize the visual design.
Attach CRUD Workflows
Wire the form's submit action to a Flow Studio workflow that contains the SqlUpdateNode generated by the AI. The form is now a fully functional data entry interface backed by your Data Ocean SQL table.
How to Trigger AI Form Generation
From AtlasForms Studio
In the AtlasForms Studio, click New Form → Generate with AI and select From SQL Schema. Paste your CREATE TABLE statement in the input box. The AI generates and previews the form before you save it.
From the API
// POST /api/forms/generate
{
"generationType": "SqlSchema",
"tenantId": 42,
"sqlSchema": "CREATE TABLE Customer (\n CustomerId uniqueidentifier NOT NULL,\n TenantId int NOT NULL,\n Name nvarchar(300) NOT NULL,\n Email nvarchar(300) NOT NULL,\n Phone nvarchar(50) NULL,\n Industry nvarchar(200) NULL,\n Status nvarchar(50) NOT NULL DEFAULT 'Active',\n CreatedAt datetime2 NOT NULL,\n UpdatedAt datetime2 NOT NULL,\n IsDeleted bit NOT NULL DEFAULT 0\n)",
"formOptions": {
"excludeColumns": ["TenantId", "CreatedAt", "UpdatedAt", "IsDeleted", "DeletedAt"],
"primaryKeyColumn": "CustomerId",
"generateSqlCommands": true,
"datasourceId": "customer-data-db"
}
}
What the AI Generates
For the Customer table example, the AI generates:
Field Mappings
| Column | SQL Type | Form Control | Validation |
|---|---|---|---|
| Name | nvarchar(300) NOT NULL | Text Input | Required, MaxLength: 300 |
| nvarchar(300) NOT NULL | Email Input | Required, Email format, MaxLength: 300 | |
| Phone | nvarchar(50) NULL | Phone Input | Optional, Phone format, MaxLength: 50 |
| Industry | nvarchar(200) NULL | Text Input or Dropdown | Optional, MaxLength: 200 |
| Status | nvarchar(50) NOT NULL DEFAULT 'Active' | Dropdown (Active, Inactive) | Required, Default: Active |
Generated SQL Commands
-- INSERT command for form submit
INSERT INTO Customer
(CustomerId, TenantId, Name, Email, Phone, Industry, Status, CreatedBy, CreatedAt, UpdatedAt)
VALUES
(NEWID(), @tenantId, @name, @email, @phone, @industry, @status, @createdBy, GETUTCDATE(), GETUTCDATE())
-- UPDATE command for form edit submit
UPDATE Customer SET
Name = @name,
Email = @email,
Phone = @phone,
Industry = @industry,
Status = @status,
UpdatedAt = GETUTCDATE()
WHERE TenantId = @tenantId
AND CustomerId = @customerId
AND IsDeleted = 0
The excludeColumns option prevents system-managed columns (TenantId, CreatedAt, UpdatedAt, IsDeleted) from appearing in the form as user-editable fields. The AI generates the SQL commands with these columns hardcoded to their system-managed values.
Customizing the Generated Form
After importing the generated form into AtlasForms Studio, common customizations include:
- Field ordering: Drag fields into the logical order for data entry (e.g., Name before Email)
- Section grouping: Group related fields into form sections (e.g., "Contact Information", "Account Details")
- Dropdown options: Replace free-text fields with dropdowns bound to reference data
- Conditional visibility: Show/hide fields based on values of other fields
- Custom validation: Add business rules beyond what SQL constraints express (e.g., "Email must be from approved domains")
- Field labels: Replace column-name-derived labels with user-friendly text