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

Adbc ingestion #62

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Adbc ingestion #62

wants to merge 5 commits into from

Conversation

dejandbt
Copy link
Collaborator

@dejandbt dejandbt commented Feb 6, 2025

Context

Changes proposed in this pull request

  • [List the main changes you've made]

Guidance to review

[Help reviewers know where to focus their efforts, or flag controversial decisions]

Relevant links

  • [List any useful links]

Checklist:

  • My code follows the style guidelines of this project
  • New and existing unit tests pass locally with my changes
  • I've changed or updated relevant documentation

@wpfl-dbt
Copy link
Collaborator

wpfl-dbt commented Feb 6, 2025

Couple of comments and questions.

  • I'd prefer production SQL be implemented in SQLAlchemy unless there's no other way
  • The Engine object has all the information you need in it to build the adbc_driver_postgresql.dbapi object
  • Why haven't you just replaced batch_ingest()? It feels like having a single function that can be used on each table would be more extensible in the future, especially as we're considering new tables
  • In batch_ingest() you'll see an isolate_table() function. It's interesting for a couple of reasons:
    • It shows some of the ways you can deal with indices, constraints, and table creation in pure SQLAlchemy
    • It's necessary because DeclarativeMeta objects (like Clusters, Contains etc) actually contain the entire Metadata of the ORM. This insight is hugely important because it means from a single DeclarativeMeta object you can access not only the constraints and indices of the table you're working with, but other table's foreign keys into that table. I believe that all the information you need to do the swap should be in the DeclarativeMeta object

from matchbox.server.postgresql.utils.db import adbc_ingest_data, _adbc_insert_data, _save_to_postgresql, _run_query, _run_queries


class TestAdbcIngestData(unittest.TestCase):
Copy link
Collaborator

Choose a reason for hiding this comment

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

We test using pytest, though we do use unittest for mocks.

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.

2 participants