Skip to content

Conversation

Harshg999
Copy link
Collaborator

This pull request introduces a new API endpoint for creating SQL tables from file data, along with the supporting serializer and backend logic. The changes include defining the create_table API, implementing the corresponding serializer for request validation, and adding a placeholder function for the table creation operation.

Addition of the create_table API:

Serializer for request validation:

Backend logic for table creation:

@Harshg999 Harshg999 self-assigned this Jun 9, 2025
@Copilot Copilot AI review requested due to automatic review settings June 9, 2025 12:33
@github-actions
Copy link

github-actions bot commented Jun 9, 2025

⚠️ No test files modified. Please ensure that changes are properly tested. ⚠️

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds a new endpoint and serializer to create SQL tables from file data and wires up a placeholder operation.

  • Introduces CreateTableSerializer to validate request parameters.
  • Registers the create_table API route and implements the view.
  • Adds a stub create_table function in operations for later implementation.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
desktop/core/src/desktop/lib/importer/serializers.py New CreateTableSerializer with field and interdependent validations
desktop/core/src/desktop/lib/importer/api.py Added create_table view using the serializer and operation stub
desktop/core/src/desktop/lib/importer/operations.py Stubbed create_table function with signature but no implementation
desktop/core/src/desktop/api_public_urls_v1.py Registered the new importer/table/create route
Comments suppressed due to low confidence (4)

desktop/core/src/desktop/lib/importer/operations.py:739

  • Add a detailed docstring for create_table explaining expected parameters, return format, and error conditions.
def create_table(

desktop/core/src/desktop/lib/importer/serializers.py:178

  • Add unit tests for CreateTableSerializer to cover defaulting logic for delimiters and validations of external, Kudu, and Iceberg parameters.
class CreateTableSerializer(serializers.Serializer):

desktop/core/src/desktop/lib/importer/api.py:285

  • Include integration tests for the create_table endpoint to verify request validation, error responses, and successful payload structure.
@api_view(["POST"])

desktop/core/src/desktop/lib/importer/operations.py:739

  • The signature references List, Dict, Any, Optional but those types are not imported; this will cause a NameError at runtime.
def create_table(

return mapping[polars_type]


def create_table(
Copy link

Copilot AI Jun 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function body is empty (pass), so calls to create_table will silently return None. Implement the table creation logic or raise NotImplementedError until ready.

Copilot uses AI. Check for mistakes.

return data


class CreateTableSerializer(serializers.Serializer):
Copy link

Copilot AI Jun 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] This serializer is very large. Consider extracting file-type–specific and table-format–specific validations into helper methods or nested serializers for readability.

Copilot uses AI. Check for mistakes.

@github-actions
Copy link

github-actions bot commented Jun 9, 2025

UI Coverage Report

Lines Statements Branches Functions
Coverage: 32%
39.15% (30527/77959) 31.01% (14247/45936) 23.89% (2130/8915)

@github-actions
Copy link

github-actions bot commented Jun 9, 2025

Python Code Coverage

Python Coverage Report •
FileStmtsMissCoverMissing
desktop/core/src/desktop/lib/importer
   operations.py2575777%37–39, 157–158, 183, 186, 195, 282, 291, 299, 312–314, 318, 321–324, 329–330, 365–367, 369, 390–391, 394, 396, 404–406, 408, 457–459, 461, 510, 527–529, 531, 598–599, 601–602, 632, 641, 661, 666–668, 670, 683–685, 687
TOTAL541852707850% 

Pytest Report

Tests Skipped Failures Errors Time
1186 106 💤 0 ❌ 0 🔥 5m 57s ⏱️

@github-actions
Copy link

This PR is stale because it has been open 45 days with no activity and is not labeled "Prevent stale". Remove "stale" label or comment or this will be closed in 10 days.

@github-actions github-actions bot added the Stale label Jul 25, 2025
@github-actions github-actions bot closed this Aug 4, 2025
@Harshg999 Harshg999 reopened this Aug 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant