-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
fix(Views): updated views to reflect refactors #1582
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Reviewed everything up to ac57b4a in 2 minutes and 51 seconds
More details
- Looked at
850
lines of code in21
files - Skipped
0
files when reviewing. - Skipped posting
10
drafted comments based on config settings.
1. tests/unit_tests/agent/test_agent.py:97
- Draft comment:
Use assert_called_once_with() instead of 'called_with()'. Replace 'assert mock_generate_code.validate_and_clean_code.called_with(cached_code)' with 'mock_generate_code.validate_and_clean_code.assert_called_once_with(cached_code)'. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
2. tests/unit_tests/agent/test_agent.py:66
- Draft comment:
Ensure that the code string returned for code generation contains proper quotes. For example, change 'print(United States has the highest gdp)' to "print('United States has the highest gdp')". - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
3. tests/unit_tests/prompts/test_sql_prompt.py:64
- Draft comment:
Review the multi-line expected prompt string for clarity and consistent formatting; consider simplifying the prompt template for readability. - Reason this comment was not posted:
Confidence changes required:50%
None
4. tests/unit_tests/data_loader/test_sql_loader.py:49
- Draft comment:
Verify the SQL query formatting in mocks. For example, check that table names are correctly substituted, matching changes from using schema.name instead of schema.source.table. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
5. tests/unit_tests/data_loader/test_loader.py:60
- Draft comment:
Ensure that schema name sanitization is consistent; consider adding comments if the transformation from non-sanitized to sanitized name is intentional. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
6. tests/unit_tests/conftest.py:145
- Draft comment:
Consider adding type hints for fixtures that return dict[str, MagicMock] for better readability. - Reason this comment was not posted:
Confidence changes required:50%
None
7. tests/unit_tests/test_config.py:52
- Draft comment:
Improve error message grammar in test cases: e.g., 'validate_llm with langchain integration' should read 'Validating llm with Langchain integration'. - Reason this comment was not posted:
Confidence changes required:50%
None
8. tests/unit_tests/agent/test_agent.py:97
- Draft comment:
Use 'assert_called_with(cached_code)' instead of 'called_with(cached_code)' to properly verify that the cached code is used. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
9. pandasai/data_loader/view_query_builder.py:47
- Draft comment:
The construction of the FROM clause in _get_from_statement is quite complex. Consider refactoring to a more robust query builder method or adding more inline comments to clarify the logic. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The comment is somewhat vague - it doesn't specify how to refactor or what specific parts need clarification. The code is already modular with helper methods. While more comments could help, the logic flow is fairly straightforward for SQL query building. The suggestion to "refactor to a more robust query builder" is not concrete enough.
The code could potentially benefit from some documentation. Breaking down the large method into smaller pieces might improve readability.
While documentation could help, the comment doesn't provide specific enough guidance to be actionable. The code is already reasonably modular with helper methods.
The comment should be deleted as it's too vague to be actionable and the code structure is already reasonably clear with helper methods.
10. pandasai/data_loader/query_builder.py:33
- Draft comment:
Ensure consistent use of table naming conventions. Other parts of the code now use 'schema.name' whereas this method uses 'schema.source.table.lower()'. - Reason this comment was not posted:
Comment was on unchanged code.
Workflow ID: wflow_mnJR8znKrCXJNEze
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems all great to me. Left couple of minor comments, good to merge afterwards!
Important
Refactor view handling and SQL query execution, update schema management, and enhance file operations with absolute paths.
create()
in__init__.py
to use absolute paths for parquet files._execute_local_sql_query()
inbase.py
to register DataFrames usingschema.name
._execute_sql_query()
inbase.py
to check forschema.source
before executing local queries.SemanticLayerSchema
insemantic_layer_schema.py
to includeis_compatible_source()
.QueryBuilder
andViewQueryBuilder
to handle view-based queries with JOINs.CodeCleaner
incode_cleaning.py
to clean SQL queries usingschema.name
.abs_path()
method toFileManager
infilemanager.py
for absolute path resolution.LocalDatasetLoader
inlocal_loader.py
to useabs_path()
for file operations.test_agent.py
,test_loader.py
, andtest_sql_loader.py
.test_code_cleaning.py
to test SQL query cleaning with new schema handling.This description was created by for ac57b4a. It will automatically update as commits are pushed.