[codex] Add workflow SQL parsing and separate DDL create flow#20
[codex] Add workflow SQL parsing and separate DDL create flow#20
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (10)
📝 WalkthroughWalkthroughThis pull request restructures the workflow submission system by introducing SQL parsing validation, DDL/DML separation, and new API endpoints. The frontend API layer is refactored with updated type signatures and three new endpoints (parse, content, rollback). A new Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Frontend as WorkflowCreateView
participant API as Backend API
participant Engine as SQL Engine
User->>Frontend: Upload/paste SQL
Frontend->>API: POST /v1/workflow/parse/
API->>Engine: generate_sql(sql_text)
Engine-->>API: statements[]
API->>API: Classify syntax_type per statement
API->>API: Detect mixed/unknown syntax
API-->>Frontend: WorkflowParseResult{statements[], summary}
Frontend->>Frontend: Validate syntax_type matches expectedSyntaxType
Frontend->>Frontend: Reject if LOAD DATA detected
Frontend-->>User: Display parsed statements or error
sequenceDiagram
participant User
participant Frontend as WorkflowCreateView
participant API as Backend API
participant DB as Database
User->>Frontend: Fill form, check SQL
Frontend->>API: POST /v1/workflow/check/
API->>API: Validate LOAD DATA pattern
API->>DB: Execute check query
DB-->>API: Check result{syntax_type, rows, status}
API-->>Frontend: WorkflowCheckResult
Frontend->>Frontend: Store check state & syntax_type
User->>Frontend: Submit workflow
Frontend->>Frontend: Verify check is current & matches expectedSyntaxType
alt Check stale or mismatch
Frontend->>API: POST /v1/workflow/check/ (re-run)
API-->>Frontend: Updated result
end
Frontend->>API: POST /v1/workflow/create/
API->>DB: Create workflow record
DB-->>API: workflow{id, ...}
API-->>Frontend: WorkflowCreateResult
Frontend->>Frontend: Navigate to workflow-detail route
Frontend-->>User: Show confirmation & redirect
sequenceDiagram
participant User
participant Frontend as WorkflowsView
participant API as Backend API
participant DB as Database
User->>Frontend: Load workflow list with scope filter
alt scope === 'mine'
Frontend->>API: GET /v1/workflow/?scope=mine
API->>DB: Filter by engineer == user
else scope === 'pending_review'
Frontend->>API: GET /v1/workflow/?scope=pending_review
API->>DB: Filter by pending_review_workflow_ids(user)
else scope === 'all'
Frontend->>API: GET /v1/workflow/
API->>DB: No scope filter
end
DB-->>API: workflows[]
API-->>Frontend: List with metadataInstanceAccessLevel[]
Frontend->>Frontend: Derive canCreateDdl/canCreateDml from allowed_syntax_types
Frontend-->>User: Render workflows list + action buttons
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…le-parse-ddl-create # Conflicts: # frontend/src/lib/api.ts # frontend/src/router/index.ts # frontend/src/views/WorkflowsView.vue # sql_api/api_workflow.py # sql_api/tests.py
Summary
Add separate SPA create flows for DDL and DML workflows, introduce shared workflow-create UI logic, and add a workflow SQL parse endpoint for DML
.sqluploads.What Changed
POST /api/v1/workflow/parse/to split SQL text into statements and classify workflow syntaxallowed_syntax_types.sqlfiles, reject mixed syntax uploads, and load parsed statements into the editorLOAD DATAstatements for workflow parsing, SQL check, and final workflow submissionWhy
The SPA only exposed a DML-specific create screen even though the workflow backend already supported both DDL and DML. It also lacked the legacy-style SQL file parsing flow needed for data update batches. This change restores file parsing for DML uploads, adds a dedicated DDL create path, and closes the gap where
LOAD DATAstatements could be treated as normal DML submissions even though the platform does not stage or manage external data files.Impact
Users can now start DDL and DML workflows from separate SPA routes, DML uploads can be parsed and reviewed before submission, and unsupported
LOAD DATAtasks are blocked consistently in both the SPA and legacy submit flows.Validation
black --check .npm run buildinfrontend/docker exec datamingle-app python manage.py test sql_api.tests.TestWorkflowdocker exec datamingle-app python manage.py makemigrations sql --checkSummary by CodeRabbit
New Features
Bug Fixes