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

Feature/adbc flight sql #5010

Closed
wants to merge 9 commits into from
Closed

Feature/adbc flight sql #5010

wants to merge 9 commits into from

Conversation

prmoore77
Copy link

I have added a new ADBC Flight SQL back-end with the help of @lidavidm and @gforsyth . I haven't added tests as of yet - so this PR isn't ready to merge, but I will work with the Ibis team to learn what to do :). Thank you!

@github-actions
Copy link
Contributor

github-actions bot commented Dec 13, 2022

Test Results

       46 files         46 suites   1h 56m 0s ⏱️
14 022 tests 10 535 ✔️   3 486 💤 0  1 🔥
52 254 runs  38 587 ✔️ 13 663 💤 0  4 🔥

For more details on these errors, see this check.

Results for commit 2d9c430.

♻️ This comment has been updated with latest results.

@gforsyth gforsyth marked this pull request as draft December 13, 2022 21:47
@gforsyth
Copy link
Member

Thanks @prmoore77! We'll need to set up some test infrastructure around this -- I'm going to look at generating the required tables and inserting them into the dockerized flight-sql server on demand.

@codecov
Copy link

codecov bot commented Dec 15, 2022

Codecov Report

Merging #5010 (19ea650) into master (0f304e5) will decrease coverage by 7.49%.
The diff coverage is 45.00%.

❗ Current head 19ea650 differs from pull request most recent head 4db7d0b. Consider uploading reports for the commit 4db7d0b to get more accurate results

@@            Coverage Diff             @@
##           master    #5010      +/-   ##
==========================================
- Coverage   95.10%   87.61%   -7.50%     
==========================================
  Files         401      211     -190     
  Lines       44705    23289   -21416     
  Branches     4379     3246    -1133     
==========================================
- Hits        42516    20404   -22112     
- Misses       1690     2463     +773     
+ Partials      499      422      -77     
Impacted Files Coverage Δ
ibis/backends/adbc/__init__.py 45.00% <45.00%> (ø)
ibis/backends/bigquery/version.py 0.00% <0.00%> (-100.00%) ⬇️
ibis/backends/bigquery/rewrites.py 0.00% <0.00%> (-100.00%) ⬇️
ibis/backends/bigquery/operations.py 0.00% <0.00%> (-100.00%) ⬇️
ibis/backends/bigquery/udf/rewrite.py 0.00% <0.00%> (-100.00%) ⬇️
ibis/backends/bigquery/registry.py 0.00% <0.00%> (-98.22%) ⬇️
ibis/backends/bigquery/compiler.py 0.00% <0.00%> (-97.02%) ⬇️
ibis/backends/bigquery/datatypes.py 0.00% <0.00%> (-96.50%) ⬇️
ibis/backends/bigquery/udf/__init__.py 0.00% <0.00%> (-96.30%) ⬇️
ibis/backends/snowflake/registry.py 0.00% <0.00%> (-94.74%) ⬇️
... and 370 more

@@ -0,0 +1,106 @@
# Copyright 2015 Cloudera Inc.
Copy link
Member

Choose a reason for hiding this comment

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

I don't think you need this license header.

@@ -167,6 +167,7 @@ snowflake = "ibis.backends.snowflake"
spark = "ibis.backends.pyspark"
sqlite = "ibis.backends.sqlite"
trino = "ibis.backends.trino"
adbc = "ibis.backends.adbc"
Copy link
Member

Choose a reason for hiding this comment

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

You also need to add adbc to the extras section and declare its list of optional dependencies. Looking at your code, I think that's at least adbc = ["pyarrow", "sqlalchemy"] and possibly more if there's an ADBC dependency somewhere.

adbc = pytest.importorskip("pyarrow.flight_sql")

@staticmethod
@functools.lru_cache(maxsize=None)
Copy link
Member

Choose a reason for hiding this comment

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

I wouldn't worry about caching yet.

def connect(data_directory: Path) -> BaseBackend:

flight_password = os.environ["FLIGHT_PASSWORD"]
authorization_header = f"Basic {str(base64.b64encode(bytes(f'flight_username:{flight_password}', encoding='utf-8')), encoding='utf-8')}"
Copy link
Member

Choose a reason for hiding this comment

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

Pull the f-string expression out into a variable :)

Comment on lines +48 to +49
"""
Create an Ibis client connected via ADBC.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"""
Create an Ibis client connected via ADBC.
"""Create an Ibis client connected via ADBC.

Example: grpc+tls://localhost:31337
dialect
The SQLAlchemy dialect name (the scheme of a connection URI).
db_kwargs
Copy link
Member

Choose a reason for hiding this comment

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

Why not accept **kwargs and just thread that through?


return result

def _sqla_connect(self, dialect, conn_rec, conn_args, conn_params):
Copy link
Member

Choose a reason for hiding this comment

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

Does this need to be a method as opposed to a function defined inline in do_connect? You're not using self anywhere here.

@lidavidm
Copy link

lidavidm commented Jan 6, 2023

The other thing is, I think in the previous ADBC related PRs we discussed whether ADBC should be a backend, or a base backend (like SQLAlchemy) - so are we ok having it as a toplevel backend here? (The latter makes slightly more sense to me.)

@cpcloud
Copy link
Member

cpcloud commented Mar 6, 2023

Superseded by #5475.

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.

4 participants