Skip to content

fix: set MongoDB max_table_nesting to 0#572

Open
karakanb wants to merge 1 commit intomainfrom
mongo-max-nesting
Open

fix: set MongoDB max_table_nesting to 0#572
karakanb wants to merge 1 commit intomainfrom
mongo-max-nesting

Conversation

@karakanb
Copy link
Copy Markdown
Contributor

Sets max_table_nesting to 0 for MongoDB sources in both the custom query and default collection code paths. Previously this was set to 1, which could result in unwanted nested table expansion.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 26, 2026

Important Files Changed

Filename Overview
ingestr/src/sources.py Sets max_table_nesting to 0 (from 1) in both the custom query and default collection paths for MongoDbSource, preventing unwanted nested table expansion.

Comments Outside Diff (1)

  1. ingestr/src/sources_test.py, line 159-161 (link)

    P2 Missing assertion for max_table_nesting

    The existing tests don't assert that max_table_nesting is set to 0 on the returned resource. Without this, a future regression (e.g. reverting back to 1) would go undetected.

    Consider adding an assertion in both test_table_instance_is_created and test_table_instance_is_created_with_incremental:

    source = MongoDbSource(table_builder=mongo)
    res = source.dlt_source(uri, table)
    self.assertIsNotNone(res)
    self.assertEqual(res.max_table_nesting, 0)
    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: ingestr/src/sources_test.py
    Line: 159-161
    
    Comment:
    **Missing assertion for `max_table_nesting`**
    
    The existing tests don't assert that `max_table_nesting` is set to `0` on the returned resource. Without this, a future regression (e.g. reverting back to `1`) would go undetected.
    
    Consider adding an assertion in both `test_table_instance_is_created` and `test_table_instance_is_created_with_incremental`:
    ```python
    source = MongoDbSource(table_builder=mongo)
    res = source.dlt_source(uri, table)
    self.assertIsNotNone(res)
    self.assertEqual(res.max_table_nesting, 0)
    ```
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: ingestr/src/sources_test.py
Line: 159-161

Comment:
**Missing assertion for `max_table_nesting`**

The existing tests don't assert that `max_table_nesting` is set to `0` on the returned resource. Without this, a future regression (e.g. reverting back to `1`) would go undetected.

Consider adding an assertion in both `test_table_instance_is_created` and `test_table_instance_is_created_with_incremental`:
```python
source = MongoDbSource(table_builder=mongo)
res = source.dlt_source(uri, table)
self.assertIsNotNone(res)
self.assertEqual(res.max_table_nesting, 0)
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix: set MongoDB max_table_nesting to 0" | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant