Skip to content

Conversation

@PeterLappo
Copy link
Contributor

Hi,
I've added some system information to the prestodb JDBC driver so that you can see schema, table and column data in tools like dbeaver which are Java tools that use the presto JDBC driver. I'm presuming but haven't tested it that it will also work with presto ODBC drivers.
Here are a couple of dbeaver screen shots.
dbeaver1
dbeaver2

Thanks

Copy link
Collaborator

@charlesbluca charlesbluca left a comment

Choose a reason for hiding this comment

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

Thanks for the work here @PeterLappo 😄 a couple comments:

Also looks like this PR is failing style checks, this should be resolved by running pre-commit run --all-files on your branch and pushing the resulting changes

Comment on lines 112 to 155
def create_table_row(a_str: str = "any", an_int: int = 1, a_float: float = 1.1):
return {
"A_STR": a_str,
"AN_INT": an_int,
"A_FLOAT": a_float,
}


def check_data(app_client):
response = app_client.post("/v1/statement", data=f"SELECT * from {schema}.{table}")
assert response.status_code == 200
a_table = get_result_or_error(app_client, response)
assert "columns" in a_table
assert "data" in a_table
assert "error" not in a_table


def get_result_or_error(app_client, response):
result = response.json()

assert "nextUri" in result
assert "error" not in result

status_url = result["nextUri"]
next_url = status_url

counter = 0
while True:
response = app_client.get(next_url)
assert response.status_code == 200

result = response.json()

if "nextUri" not in result:
break

next_url = result["nextUri"]

counter += 1
assert counter <= 100

sleep(0.1)

return result No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor nitpick but could these util functions be moved above the test functions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I come from a Java world where the convention is to put "private" code at the end but actually coped from test_server.py which has it at the end. Shall I re-use from test_server.py? @charlesbluca

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah I didn't realize that this was also the case in test_server.py; in that case my preference would be to move the util functions up to the top in both files - my reasoning here being to match up with other testing files (such as test_compatibility.py) that place their utility functions at the top of the file.

I also note that since we are duplicating functions like get_result_or_error, we might want to add a testing utility module as a central location for functions like this, but that is out of the scope of this PR.

Comment on lines 52 to 72
assert "columns" in result
assert "data" in result
assert "error" not in result
assert result["columns"] == [
{
"name": "TABLE_CATALOG",
"type": "varchar",
"typeSignature": {"rawType": "varchar", "arguments": []},
},
{
"name": "TABLE_SCHEM",
"type": "varchar",
"typeSignature": {"rawType": "varchar", "arguments": []},
}
]
assert len(result["data"]) == 3
assert result["data"] == [
["", "root"],
["", "a_schema"],
["", "system_jdbc"],
]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wondering if there is a way to place these assertions in a helper function like assert_resp to simplify the tests; okay if this isn't possible

PeterLappo and others added 3 commits January 3, 2022 20:03
Remove debug code

Co-authored-by: Charles Blackmon-Luca <[email protected]>
Simplify code

Co-authored-by: Charles Blackmon-Luca <[email protected]>
@PeterLappo
Copy link
Contributor Author

@charlesbluca Updated as recommended. What is the next step to merge to main?

@GPUtester
Copy link

Can one of the admins verify this patch?

@charlesbluca
Copy link
Collaborator

add to allowlist

PeterLappo and others added 2 commits January 16, 2022 20:20
Co-authored-by: Charles Blackmon-Luca <[email protected]>
Co-authored-by: Charles Blackmon-Luca <[email protected]>
Copy link
Collaborator

@charlesbluca charlesbluca left a comment

Choose a reason for hiding this comment

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

Thanks for addressing my concerns @PeterLappo 🙂 would you mind merging the latest changes? Believe the last test failures were due to some changes in upstream libraries which should be resolved now

@PeterLappo
Copy link
Contributor Author

@charlesbluca have merged with main. Does CI pipeline run automatically?

@codecov-commenter
Copy link

codecov-commenter commented Jan 31, 2022

Codecov Report

Merging #351 (1dc4812) into main (366ebf6) will decrease coverage by 0.11%.
The diff coverage is 89.09%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #351      +/-   ##
==========================================
- Coverage   95.60%   95.48%   -0.12%     
==========================================
  Files          67       68       +1     
  Lines        2932     2987      +55     
  Branches      547      554       +7     
==========================================
+ Hits         2803     2852      +49     
- Misses         79       83       +4     
- Partials       50       52       +2     
Impacted Files Coverage Δ
dask_sql/server/presto_jdbc.py 88.67% <88.67%> (ø)
dask_sql/server/app.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 366ebf6...1dc4812. Read the comment docs.

@charlesbluca
Copy link
Collaborator

Thanks!

Does CI pipeline run automatically?

It normally does, but since you haven't pushed any commits to this repo your PR requires approval for CI to run - I've approved and this should be good to merge if tests pass

@charlesbluca charlesbluca merged commit 20c8e26 into dask-contrib:main Jan 31, 2022
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