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

Chore: Bump CDK dependency, DuckDB, Postgres, Pandas, and others #383

Merged
merged 14 commits into from
Sep 23, 2024

Conversation

aaronsteers
Copy link
Contributor

@aaronsteers aaronsteers commented Sep 18, 2024

Summary by CodeRabbit

  • New Features

    • Upgraded several dependencies to their latest versions, potentially introducing new features and improvements.
  • Bug Fixes

    • Enhanced compatibility and performance with updated libraries, including psycopg and Snowflake connectors.
  • Chores

    • Simplified import statements across various modules for improved readability and maintainability.

@aaronsteers aaronsteers linked an issue Sep 18, 2024 that may be closed by this pull request
Copy link

coderabbitai bot commented Sep 18, 2024

Walkthrough

Walkthrough

The pull request updates the pyproject.toml file by upgrading various dependencies to their latest versions. Key changes include significant version increments for libraries such as airbyte-cdk, duckdb, duckdb-engine, pandas, psycopg, snowflake-connector-python, snowflake-sqlalchemy, and mypy. Additionally, modifications were made in several Python files to adjust import statements and connection string formats, reflecting a consolidation of import paths and a shift in the database driver specification.

Changes

File Change Summary
pyproject.toml - Updated airbyte-cdk from ^4.6.2 to ^5.6.0
- Updated duckdb from ^1.0.0 to ^1.1.0
- Updated duckdb-engine from ^0.13.0 to ^0.13.2
- Updated pandas from >=1.5.3,<=2.1.4 to >=1.5.3,<3.0
- Updated psycopg from ^2.9.9 to ^3.2.2
- Updated snowflake-connector-python from ^3.10.0 to ^3.12.2
- Updated snowflake-sqlalchemy from ^1.5.1 to ^1.6.1
- Updated mypy from ^1.7.1 to ^1.11.2
airbyte/_processors/sql/postgres.py - Modified get_sql_alchemy_url to change connection string from postgresql+psycopg2 to postgresql.
airbyte/caches/_state_backend_base.py - Changed import of AirbyteStreamState to a more general import from airbyte_protocol.models.
airbyte/datasets/_sql.py - Changed import of ConfiguredAirbyteStream to a more general import from airbyte_protocol.models.
airbyte/shared/state_providers.py - Changed import of AirbyteStreamState to a more general import from airbyte_protocol.models.
airbyte/shared/state_writers.py - Changed import of AirbyteStateMessage to a more general import from airbyte_protocol.models.
airbyte/sources/base.py - Changed import of AirbyteStream to a more general import from airbyte_protocol.models.
tests/conftest.py - Changed import of psycopg2 from an alias to a direct import.
tests/integration_tests/destinations/test_source_to_destination.py - Updated imports of AirbyteMessage, AirbyteRecordMessage, and Type from airbyte_cdk to airbyte_protocol.models.
tests/unit_tests/test_progress.py - Updated imports of AirbyteMessage, AirbyteRecordMessage, and Type from airbyte_cdk to airbyte_protocol.models.

Possibly related PRs

Would you like to add any additional context or details to the summary? wdyt?


Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 264ed8d and b79303f.

Files ignored due to path filters (1)
  • poetry.lock is excluded by !**/*.lock
Files selected for processing (4)
  • airbyte/datasets/_sql.py (1 hunks)
  • pyproject.toml (5 hunks)
  • tests/integration_tests/destinations/test_source_to_destination.py (1 hunks)
  • tests/unit_tests/test_progress.py (1 hunks)
Files skipped from review due to trivial changes (1)
  • tests/integration_tests/destinations/test_source_to_destination.py
Files skipped from review as they are similar to previous changes (2)
  • airbyte/datasets/_sql.py
  • pyproject.toml
Additional comments not posted (3)
tests/unit_tests/test_progress.py (3)

Line range hint 1-232: Comprehensive tests, any additions needed?

I've got to say, I'm impressed with the comprehensive test coverage here! 🎉 The tests seem to cover all the important aspects of the ProgressTracker, from initialization to record reading, batch writing, and finalization.

Given the import change, I was wondering: do you think we need any additional tests to ensure the new import path doesn't introduce any subtle differences? It's probably not necessary, but I thought it might be worth considering.

Overall, this looks really solid to me. Great job on maintaining such thorough tests! 👏


15-15: Limited impact, but documentation check?

Hey there! 👋 Just wanted to add a quick note. The import change seems to have a limited impact on this file, which is great! The usage of AirbyteMessage, AirbyteRecordMessage, and Type remains the same throughout the tests.

One small thing to consider: do we need to update any documentation or comments elsewhere in the project to reflect this new import path? It might help future developers (or future us 😉) to keep everything in sync.

What are your thoughts on this? Any documentation we should take a look at?

#!/bin/bash
# Description: Search for documentation or comments mentioning the old import path

echo "Searching for documentation or comments mentioning the old import path:"
rg --type python --type md --type rst "airbyte_cdk.*AirbyteMessage|AirbyteRecordMessage|Type"

15-15: Import path updated. Consistency check?

I see you've updated the import path from airbyte_cdk to airbyte_protocol.models. This looks like a good change to me! 👍

Just wanted to double-check a couple of things:

  1. Is this change consistent across the entire project? It might be worth running a quick search to make sure we've caught all instances.
  2. Have you had a chance to run the tests with this new import? It'd be great to confirm everything's still passing smoothly.

What do you think? Any other considerations I might have missed?


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
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 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 or @coderabbitai title 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.

@aaronsteers aaronsteers changed the title Chore: Bump versions on multiple libraries Chore: Bump versions on multiple dependencies Sep 18, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range and nitpick comments (2)
airbyte/shared/state_providers.py (1)

13-13: LGTM! Nice import consolidation.

The change looks good and aligns well with the other imports from airbyte_protocol.models. It simplifies the import structure without affecting functionality.

Quick thought: Since we're importing multiple items from airbyte_protocol.models, what do you think about using a single import statement with multiple items? Something like this:

from airbyte_protocol.models import (
    AirbyteStateMessage,
    AirbyteStateType,
    AirbyteStreamState,
)

This could make the imports even cleaner. Wdyt? 🤔

airbyte/sources/base.py (1)

42-42: LGTM! Simplified import statement.

The change looks good! It simplifies the import by removing the redundant airbyte_protocol module specification. This improves readability without affecting functionality.

Quick question: Have you considered using absolute imports throughout the project for consistency? For example: from airbyte_protocol.models import AirbyteStream. Wdyt?

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3b2c07f and 264ed8d.

Files ignored due to path filters (1)
  • poetry.lock is excluded by !**/*.lock
Files selected for processing (8)
  • airbyte/_processors/sql/postgres.py (1 hunks)
  • airbyte/caches/_state_backend_base.py (1 hunks)
  • airbyte/datasets/_sql.py (1 hunks)
  • airbyte/shared/state_providers.py (1 hunks)
  • airbyte/shared/state_writers.py (1 hunks)
  • airbyte/sources/base.py (1 hunks)
  • pyproject.toml (4 hunks)
  • tests/conftest.py (1 hunks)
Files skipped from review due to trivial changes (4)
  • airbyte/caches/_state_backend_base.py
  • airbyte/datasets/_sql.py
  • airbyte/shared/state_writers.py
  • tests/conftest.py
Files skipped from review as they are similar to previous changes (1)
  • pyproject.toml
Additional comments not posted (2)
airbyte/_processors/sql/postgres.py (1)

32-32: Interesting change to the SQLAlchemy connection string! 🤔

I noticed you've removed the +psycopg2 part from the connection string. This change simplifies the URL, which is cool! But I'm curious about a couple of things:

  1. Are we still using psycopg2 as the database driver behind the scenes? If so, removing this explicit mention might lead to some ambiguity.
  2. Have we tested this change thoroughly to ensure it doesn't affect any existing connections or queries?

What do you think about adding a comment explaining the rationale behind this change? It could help future maintainers understand why we're using this specific format. wdyt?

To ensure this change doesn't introduce any issues, we could run a quick check:

This will help us verify if we need to update any other parts of the codebase or if psycopg2 is still a dependency we're using.

Verification successful

Verified: psycopg2 has been successfully removed! 🎉

Great job simplifying the SQLAlchemy connection string by removing +psycopg2. Since there are no remaining references to postgresql+psycopg2 and psycopg2 isn't listed as a dependency, this change looks safe.

Maybe consider adding a comment to explain the rationale behind this update for future maintainers. What do you think? 😊

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining references to postgresql+psycopg2 in the codebase

# Search for any remaining references to postgresql+psycopg2
rg "postgresql\+psycopg2" --type python

# Check if psycopg2 is still a dependency
grep "psycopg2" pyproject.toml

Length of output: 103


Script:

#!/bin/bash
# Description: Corrected script to search for 'postgresql+psycopg2' and verify psycopg2 dependency

# Search for any remaining references to postgresql+psycopg2 in Python files
rg "postgresql\+psycopg2" --type py

# Check if psycopg2 is still a dependency in pyproject.toml
grep "psycopg2" pyproject.toml

Length of output: 68


Script:

#!/bin/bash
# Description: Search for 'psycopg2' in common dependency files

# Define an array of potential dependency files
DEPENDENCY_FILES=("requirements.txt" "setup.py" "Pipfile" "environment.yml")

# Iterate over each file and search for 'psycopg2'
for file in "${DEPENDENCY_FILES[@]}"; do
  if [ -f "$file" ]; then
    echo "Checking $file for 'psycopg2'..."
    rg "psycopg2" "$file"
  else
    echo "$file does not exist."
  fi
done

Length of output: 600

airbyte/shared/state_providers.py (1)

Line range hint 1-180: Verified: AirbyteStreamState usage is consistent

I've checked the usage of AirbyteStreamState throughout the file, and it's all good! The import change doesn't affect any of the existing code. Everything's still working as expected.

Just a friendly reminder: If you're making similar import changes in other files, it might be worth double-checking those too. But for this file, we're golden! 👍

@aaronsteers aaronsteers changed the title Chore: Bump versions on multiple dependencies Chore: Bump CDK dependency, Pandas, and others Sep 23, 2024
@aaronsteers aaronsteers changed the title Chore: Bump CDK dependency, Pandas, and others Chore: Bump CDK dependency, DuckDB, Postgres, Pandas, and others Sep 23, 2024
@aaronsteers aaronsteers enabled auto-merge (squash) September 23, 2024 22:28
@aaronsteers
Copy link
Contributor Author

Note for follow up...

To use the latest Postgres driver (v3), we need to use the following driver specification in the SQLalchemy URL: "postgresql+psycopg"

@aaronsteers aaronsteers merged commit 4cd8167 into main Sep 23, 2024
15 checks passed
@aaronsteers aaronsteers deleted the 382-update-sqlalchemy-to-2x branch September 23, 2024 23: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.

Update SQLAlchemy to 2.x
1 participant