Skip to content

Chore: Fix import woes#414

Merged
amotl merged 1 commit intomainfrom
fix-imports
Apr 23, 2025
Merged

Chore: Fix import woes#414
amotl merged 1 commit intomainfrom
fix-imports

Conversation

@amotl
Copy link
Copy Markdown
Member

@amotl amotl commented Apr 23, 2025

What the title says.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 23, 2025

Walkthrough

The changes update import statements across multiple modules to import specific utilities directly from their respective submodules rather than from the general cratedb_toolkit.util package. The DatabaseAdapter, boot_with_dburi, and jd imports are now sourced from their dedicated submodules. Additionally, the cratedb_toolkit/util/__init__.py file was cleared, removing re-exported imports and altering the public API surface of the util package. No functional or logic changes were made to the affected files.

Changes

File(s) Change Summary
cratedb_toolkit/cfr/cli.py
cratedb_toolkit/cfr/info.py
cratedb_toolkit/cfr/systable.py
cratedb_toolkit/cmd/tail/cli.py
cratedb_toolkit/cmd/tail/main.py
cratedb_toolkit/info/model.py
cratedb_toolkit/adapter/pymongo/api.py
cratedb_toolkit/adapter/pymongo/collection.py
cratedb_toolkit/adapter/pymongo/cursor.py
cratedb_toolkit/adapter/rockset/server/api/document.py
cratedb_toolkit/adapter/rockset/server/dependencies.py
cratedb_toolkit/datasets/model.py
cratedb_toolkit/info/cli.py
cratedb_toolkit/info/http.py
cratedb_toolkit/io/dynamodb/copy.py
cratedb_toolkit/io/kinesis/relay.py
cratedb_toolkit/io/mongodb/cdc.py
cratedb_toolkit/io/mongodb/copy.py
cratedb_toolkit/model.py
cratedb_toolkit/testing/testcontainers/cratedb.py
tests/datasets/conftest.py
tests/datasets/test_loading.py
tests/sqlalchemy/conftest.py
tests/util/database.py
Changed import of DatabaseAdapter from cratedb_toolkit.util to cratedb_toolkit.util.database.
cratedb_toolkit/cluster/cli.py Changed import of jd from cratedb_toolkit.util to cratedb_toolkit.util.data.
cratedb_toolkit/adapter/rockset/server/api/query.py Consolidated imports: DatabaseAdapter and get_table_names now both imported from cratedb_toolkit.util.database.
cratedb_toolkit/util/init.py Removed all content, eliminating re-exported imports (boot_with_dburi, jd, DatabaseAdapter).
examples/retention_edit.py Refactored imports to source boot_with_dburi, jd, and DatabaseAdapter from their specific submodules.
examples/retention_retire_cutoff.py Refactored imports to source boot_with_dburi from .cli and DatabaseAdapter from .database submodules.

Poem

In the warren of code, we hopped with care,
Imports now tidy, each in its lair.
The toolkit’s adapters, once all in a heap,
Are fetched from their homes, not buried so deep.
With __init__ swept clean and the modules aligned,
Our code is more clear, by design refined!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c1c0984 and e3e03c8.

📒 Files selected for processing (29)
  • cratedb_toolkit/adapter/pymongo/api.py (1 hunks)
  • cratedb_toolkit/adapter/pymongo/collection.py (1 hunks)
  • cratedb_toolkit/adapter/pymongo/cursor.py (1 hunks)
  • cratedb_toolkit/adapter/rockset/server/api/document.py (1 hunks)
  • cratedb_toolkit/adapter/rockset/server/api/query.py (1 hunks)
  • cratedb_toolkit/adapter/rockset/server/dependencies.py (1 hunks)
  • cratedb_toolkit/cfr/cli.py (1 hunks)
  • cratedb_toolkit/cfr/info.py (1 hunks)
  • cratedb_toolkit/cfr/systable.py (1 hunks)
  • cratedb_toolkit/cluster/cli.py (1 hunks)
  • cratedb_toolkit/cmd/tail/cli.py (1 hunks)
  • cratedb_toolkit/cmd/tail/main.py (1 hunks)
  • cratedb_toolkit/datasets/model.py (1 hunks)
  • cratedb_toolkit/info/cli.py (1 hunks)
  • cratedb_toolkit/info/http.py (1 hunks)
  • cratedb_toolkit/info/model.py (1 hunks)
  • cratedb_toolkit/io/dynamodb/copy.py (1 hunks)
  • cratedb_toolkit/io/kinesis/relay.py (1 hunks)
  • cratedb_toolkit/io/mongodb/cdc.py (1 hunks)
  • cratedb_toolkit/io/mongodb/copy.py (1 hunks)
  • cratedb_toolkit/model.py (1 hunks)
  • cratedb_toolkit/testing/testcontainers/cratedb.py (1 hunks)
  • cratedb_toolkit/util/__init__.py (0 hunks)
  • examples/retention_edit.py (1 hunks)
  • examples/retention_retire_cutoff.py (1 hunks)
  • tests/datasets/conftest.py (1 hunks)
  • tests/datasets/test_loading.py (1 hunks)
  • tests/sqlalchemy/conftest.py (1 hunks)
  • tests/util/database.py (1 hunks)
💤 Files with no reviewable changes (1)
  • cratedb_toolkit/util/init.py
✅ Files skipped from review due to trivial changes (18)
  • cratedb_toolkit/cfr/info.py
  • cratedb_toolkit/info/model.py
  • cratedb_toolkit/info/cli.py
  • cratedb_toolkit/adapter/rockset/server/api/document.py
  • tests/sqlalchemy/conftest.py
  • cratedb_toolkit/adapter/rockset/server/dependencies.py
  • tests/datasets/conftest.py
  • tests/util/database.py
  • tests/datasets/test_loading.py
  • cratedb_toolkit/info/http.py
  • cratedb_toolkit/cfr/cli.py
  • cratedb_toolkit/cfr/systable.py
  • cratedb_toolkit/cmd/tail/main.py
  • cratedb_toolkit/cmd/tail/cli.py
  • cratedb_toolkit/datasets/model.py
  • examples/retention_edit.py
  • cratedb_toolkit/adapter/pymongo/cursor.py
  • examples/retention_retire_cutoff.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • cratedb_toolkit/cluster/cli.py
🧰 Additional context used
🧬 Code Graph Analysis (8)
cratedb_toolkit/adapter/pymongo/api.py (3)
tests/datasets/conftest.py (1)
  • database (8-13)
tests/sqlalchemy/conftest.py (1)
  • database (8-13)
cratedb_toolkit/util/database.py (1)
  • DatabaseAdapter (36-371)
cratedb_toolkit/adapter/pymongo/collection.py (1)
cratedb_toolkit/util/database.py (1)
  • DatabaseAdapter (36-371)
cratedb_toolkit/adapter/rockset/server/api/query.py (1)
cratedb_toolkit/util/database.py (2)
  • DatabaseAdapter (36-371)
  • get_table_names (427-438)
cratedb_toolkit/io/mongodb/cdc.py (1)
cratedb_toolkit/util/database.py (1)
  • DatabaseAdapter (36-371)
cratedb_toolkit/io/dynamodb/copy.py (1)
cratedb_toolkit/util/database.py (1)
  • DatabaseAdapter (36-371)
cratedb_toolkit/io/kinesis/relay.py (1)
cratedb_toolkit/util/database.py (1)
  • DatabaseAdapter (36-371)
cratedb_toolkit/io/mongodb/copy.py (1)
cratedb_toolkit/util/database.py (1)
  • DatabaseAdapter (36-371)
cratedb_toolkit/testing/testcontainers/cratedb.py (3)
tests/datasets/conftest.py (1)
  • database (8-13)
tests/sqlalchemy/conftest.py (1)
  • database (8-13)
cratedb_toolkit/util/database.py (1)
  • DatabaseAdapter (36-371)
🪛 GitHub Check: codecov/patch
cratedb_toolkit/io/mongodb/cdc.py

[warning] 25-25: cratedb_toolkit/io/mongodb/cdc.py#L25
Added line #L25 was not covered by tests

cratedb_toolkit/io/dynamodb/copy.py

[warning] 14-14: cratedb_toolkit/io/dynamodb/copy.py#L14
Added line #L14 was not covered by tests

cratedb_toolkit/io/kinesis/relay.py

[warning] 13-13: cratedb_toolkit/io/kinesis/relay.py#L13
Added line #L13 was not covered by tests

cratedb_toolkit/io/mongodb/copy.py

[warning] 16-16: cratedb_toolkit/io/mongodb/copy.py#L16
Added line #L16 was not covered by tests

cratedb_toolkit/model.py

[warning] 131-131: cratedb_toolkit/model.py#L131
Added line #L131 was not covered by tests

cratedb_toolkit/testing/testcontainers/cratedb.py

[warning] 26-26: cratedb_toolkit/testing/testcontainers/cratedb.py#L26
Added line #L26 was not covered by tests

⏰ Context from checks skipped due to timeout of 90000ms (27)
  • GitHub Check: codecov/patch
  • GitHub Check: Python 3.11, MongoDB 7 on OS ubuntu-latest
  • GitHub Check: Python 3.11, MongoDB 5 on OS ubuntu-latest
  • GitHub Check: Python 3.11, MongoDB 4 on OS ubuntu-latest
  • GitHub Check: Python 3.11, MongoDB 3 on OS ubuntu-latest
  • GitHub Check: Python 3.9, MongoDB 7 on OS ubuntu-latest
  • GitHub Check: Python 3.9, MongoDB 6 on OS ubuntu-latest
  • GitHub Check: Generic: Python 3.12 on OS ubuntu-latest
  • GitHub Check: Python 3.9, MongoDB 5 on OS ubuntu-latest
  • GitHub Check: Python 3.9, MongoDB 4 on OS ubuntu-latest
  • GitHub Check: Python 3.9, MongoDB 3 on OS ubuntu-latest
  • GitHub Check: Generic: Python 3.9 on OS ubuntu-latest
  • GitHub Check: Python 3.8, MongoDB 7 on OS ubuntu-latest
  • GitHub Check: Python 3.8, MongoDB 6 on OS ubuntu-latest
  • GitHub Check: Generic: Python 3.8 on OS ubuntu-latest
  • GitHub Check: Python 3.8, MongoDB 5 on OS ubuntu-latest
  • GitHub Check: Kinesis: Python 3.12 on OS ubuntu-latest
  • GitHub Check: CFR for OS windows-latest
  • GitHub Check: Python 3.8, MongoDB 4 on OS ubuntu-latest
  • GitHub Check: Kinesis: Python 3.9 on OS ubuntu-latest
  • GitHub Check: Python 3.8, MongoDB 3 on OS ubuntu-latest
  • GitHub Check: CFR for OS ubuntu-latest
  • GitHub Check: Python 3.11, LocalStack 3.6, OS ubuntu-latest
  • GitHub Check: Python 3.9, LocalStack 3.6, OS ubuntu-latest
  • GitHub Check: CFR for OS macos-latest
  • GitHub Check: build-and-test
  • GitHub Check: CFR for OS macos-13
🔇 Additional comments (9)
cratedb_toolkit/io/dynamodb/copy.py (1)

14-14: Import path update looks good!

Updated import to use the specific module cratedb_toolkit.util.database for DatabaseAdapter instead of importing from the general utility package. This is a good practice for clarity and maintainability.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 14-14: cratedb_toolkit/io/dynamodb/copy.py#L14
Added line #L14 was not covered by tests

cratedb_toolkit/testing/testcontainers/cratedb.py (1)

26-26: Import path update looks good!

Updated import to use the specific module cratedb_toolkit.util.database for DatabaseAdapter instead of importing from the general utility package. This change follows the pattern implemented across the codebase.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 26-26: cratedb_toolkit/testing/testcontainers/cratedb.py#L26
Added line #L26 was not covered by tests

cratedb_toolkit/io/mongodb/cdc.py (1)

25-25: Import path update looks good!

Updated import to use the specific module cratedb_toolkit.util.database for DatabaseAdapter instead of importing from the general utility package. This is consistent with the other import changes across the codebase.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 25-25: cratedb_toolkit/io/mongodb/cdc.py#L25
Added line #L25 was not covered by tests

cratedb_toolkit/model.py (1)

131-131: Import path update looks good!

Updated import to use the specific module cratedb_toolkit.util.database for DatabaseAdapter instead of importing from the general utility package. This change aligns with the broader refactoring of imports across the codebase.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 131-131: cratedb_toolkit/model.py#L131
Added line #L131 was not covered by tests

cratedb_toolkit/io/mongodb/copy.py (1)

16-16: Import path updated correctly

Updated the import path for DatabaseAdapter to be more specific, which is consistent with the overall refactoring to fix import issues in the codebase.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 16-16: cratedb_toolkit/io/mongodb/copy.py#L16
Added line #L16 was not covered by tests

cratedb_toolkit/adapter/pymongo/api.py (1)

6-6: Import path updated correctly

Updated the import path for DatabaseAdapter to be more specific, which is consistent with the overall refactoring to fix import issues in the codebase.

cratedb_toolkit/io/kinesis/relay.py (1)

13-13: Import path updated correctly

Updated the import path for DatabaseAdapter to be more specific, which is consistent with the overall refactoring to fix import issues in the codebase.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 13-13: cratedb_toolkit/io/kinesis/relay.py#L13
Added line #L13 was not covered by tests

cratedb_toolkit/adapter/pymongo/collection.py (1)

21-21: Import path updated correctly

Updated the import path for DatabaseAdapter to be more specific, which is consistent with the overall refactoring to fix import issues in the codebase.

cratedb_toolkit/adapter/rockset/server/api/query.py (1)

20-20: Import change looks good and aligns with PR objectives.

The update correctly imports DatabaseAdapter and get_table_names directly from their specific module location (cratedb_toolkit.util.database) rather than using the more general import path. This change is consistent with the PR's goal of fixing import issues and improves code organization by making imports more explicit and direct.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@amotl amotl marked this pull request as ready for review April 23, 2025 11:26
@amotl amotl merged commit 4ccdcf6 into main Apr 23, 2025
36 checks passed
@amotl amotl deleted the fix-imports branch April 23, 2025 11:26
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