Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(SemanticLayerSchema): Refactoring using SemanticLayerSchema all over the code instead of the dictionary #1520

Merged
merged 9 commits into from
Jan 14, 2025

Conversation

scaliseraoul
Copy link

@scaliseraoul scaliseraoul commented Jan 14, 2025


Important

Refactor code to use SemanticLayerSchema instead of dictionaries for schema representation, enhancing type safety and readability, with updated tests.

  • Refactoring:
    • Replace dictionary-based schema with SemanticLayerSchema in loader.py, query_builder.py, and base.py.
    • Update DatasetLoader to use SemanticLayerSchema for schema handling.
    • Modify QueryBuilder to accept SemanticLayerSchema.
  • Schema Validation:
    • Add validation for source type and fields in Source class in semantic_layer_schema.py.
    • Ensure Destination format is supported in semantic_layer_schema.py.
  • Tests:
    • Update tests in test_loader.py, test_query_builder.py, and test_semantic_layer_schema.py to use SemanticLayerSchema.
    • Add tests for schema validation and transformation handling.
  • Miscellaneous:
    • Remove _validate_schema method from DataFrame class in base.py.
    • Add to_yaml method in SemanticLayerSchema for YAML serialization.

This description was created by Ellipsis for a43c1db. It will automatically update as commits are pushed.

scaliseraoul and others added 8 commits January 13, 2025 15:32
…e, removes unreachable code and adds tests for _load_from_local_source
…into release/v3

* 'release/v3' of https://github.com/scaliseraoul/pandas-ai:
  ci: fix lint
  refactor: remove workspace
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
…into release/v3

* 'release/v3' of https://github.com/scaliseraoul/pandas-ai:
  refactor(loader): renames _load_from_source to _load_from_local_source removes unreachable code and adds tests for _load_from_local_source (Sinaptik-AI#1514)
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jan 14, 2025
Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Reviewed everything up to a43c1db in 2 minutes and 10 seconds

More details
  • Looked at 944 lines of code in 9 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 drafted comments based on config settings.
1. pandasai/data_loader/loader.py:231
  • Draft comment:
    Consider adding a check for unsupported cache formats and raise an exception to handle them explicitly.
  • Reason this comment was not posted:
    Marked as duplicate.
2. pandasai/dataframe/virtual_dataframe.py:36
  • Draft comment:
    Ensure schema.source.table and schema.description are not None before using them to initialize table_name and description.
  • Reason this comment was not posted:
    Comment did not seem useful.
3. pandasai/data_loader/loader.py:156
  • Draft comment:
    The error message for unsupported file format should be more informative. Consider using:
            raise ValueError(f"Unsupported file format: {format}. Supported formats are: 'csv', 'parquet'.")
  • Reason this comment was not posted:
    Comment was on unchanged code.
4. pandasai/data_loader/loader.py:231
  • Draft comment:
    The error message for unsupported cache format should be more informative. Consider using:
raise ValueError(f"Unsupported cache format: {cache_format}. Supported formats are: 'csv', 'parquet'.")
  • Reason this comment was not posted:
    Marked as duplicate.

Workflow ID: wflow_UnFzo6WKG0Sqz2QQ


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

pandasai/data_loader/semantic_layer_schema.py Show resolved Hide resolved
@gventuri gventuri merged commit 057bb3a into Sinaptik-AI:release/v3 Jan 14, 2025
12 checks passed
@scaliseraoul scaliseraoul deleted the release/v3 branch January 15, 2025 08:20
@scaliseraoul scaliseraoul restored the release/v3 branch January 15, 2025 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants