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

fix: ensure column name in description is string #20340

Merged
merged 2 commits into from Jun 21, 2022

Conversation

betodealmeida
Copy link
Member

SUMMARY

The redshift_connector driver returns column names as bytes in the cursor description. I added some logic to handle them correctly.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A

TESTING INSTRUCTIONS

Added a test.

ADDITIONAL INFORMATION

@codecov
Copy link

codecov bot commented Jun 9, 2022

Codecov Report

Merging #20340 (0d0dceb) into master (07b4a71) will decrease coverage by 0.16%.
The diff coverage is 90.90%.

❗ Current head 0d0dceb differs from pull request most recent head 7dbc2e6. Consider uploading reports for the commit 7dbc2e6 to get more accurate results

@@            Coverage Diff             @@
##           master   #20340      +/-   ##
==========================================
- Coverage   66.64%   66.48%   -0.17%     
==========================================
  Files        1738     1738              
  Lines       65056    65066      +10     
  Branches     6885     6885              
==========================================
- Hits        43356    43257      -99     
- Misses      19953    20062     +109     
  Partials     1747     1747              
Flag Coverage Δ
hive ?
mysql 82.29% <90.90%> (+<0.01%) ⬆️
postgres 82.36% <90.90%> (+<0.01%) ⬆️
presto ?
python 82.44% <90.90%> (-0.35%) ⬇️
sqlite 82.09% <90.90%> (+<0.01%) ⬆️
unit ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset/superset_typing.py 98.11% <ø> (ø)
superset/result_set.py 97.74% <85.71%> (-0.69%) ⬇️
superset/db_engine_specs/databricks.py 92.30% <100.00%> (+1.39%) ⬆️
superset/db_engines/hive.py 0.00% <0.00%> (-85.19%) ⬇️
superset/db_engine_specs/hive.py 70.22% <0.00%> (-15.65%) ⬇️
superset/db_engine_specs/presto.py 83.36% <0.00%> (-5.34%) ⬇️
superset/connectors/sqla/models.py 89.05% <0.00%> (-1.19%) ⬇️
superset/initialization/__init__.py 91.13% <0.00%> (-0.36%) ⬇️
superset/db_engine_specs/base.py 88.08% <0.00%> (-0.34%) ⬇️
superset/models/core.py 88.91% <0.00%> (-0.25%) ⬇️
... and 1 more

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 07b4a71...7dbc2e6. Read the comment docs.

"""
Used to ensure column names from the cursor description are strings.
"""
if isinstance(value, str):
Copy link
Member

Choose a reason for hiding this comment

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

Is this necessary? Isn’t the fallback suffice?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, it's not needed, I just thought it was clearer this way.

@betodealmeida betodealmeida requested review from hughhhh and removed request for eschutho June 14, 2022 14:32
result_set.to_pandas_df().to_markdown()
== """
| | date | open | high | low | close | adj close | volume |
|---:|:-----------|--------:|--------:|--------:|--------:|------------:|---------:|
Copy link
Member

Choose a reason for hiding this comment

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

I love it when the test is longer than the fix. :)

@michael-s-molina michael-s-molina merged commit f3b289d into apache:master Jun 21, 2022
michael-s-molina pushed a commit that referenced this pull request Jun 23, 2022
* fix: ensure column name in description is string

* Add unit test

(cherry picked from commit f3b289d)
michael-s-molina pushed a commit that referenced this pull request Jun 28, 2022
* fix: ensure column name in description is string

* Add unit test

(cherry picked from commit f3b289d)
@mistercrunch mistercrunch added 🍒 2.0.0 🍒 2.0.1 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels preset-io size/M v2.0 🍒 2.0.0 🍒 2.0.1 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants