GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Added Json type to the sqlalchemy parser by jprakash-db · Pull Request #436 · databricks/databricks-sql-python

Conversation

@jprakash-db

@jprakash-db jprakash-db commented Sep 3, 2024

Copy link
Copy Markdown
Contributor

Description

Added the Json type in the sqlalchemy types file to handle the compilation of Json to string

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jprakash-db
Added Json type to the sqlalchemy parser
ed488d2
@jprakash-db
jprakash-db requested a review from gopalldb September 3, 2024 16:04
@jprakash-db
jprakash-db requested review from andrefurlan-db, benc-db, jackyhu-db, kravets-levko, rcypher-databricks and yunbodeng-db as code owners September 3, 2024 16:04
@jprakash-db jprakash-db self-assigned this Sep 3, 2024
yunbodeng-db
yunbodeng-db reviewed Sep 3, 2024
View reviewed changes
Comment thread src/databricks/sqlalchemy/_types.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

jprakash-db added 2 commits September 4, 2024 10:08
@jprakash-db
Added Tests for Json Type
cf2f4a0
@jprakash-db
Minor fix
d796304
yunbodeng-db
yunbodeng-db reviewed Sep 4, 2024
View reviewed changes
Comment thread src/databricks/sqlalchemy/test_local/test_types.py
sqlalchemy.types.INT: DatabricksDataType.INT,
sqlalchemy.types.SMALLINT: DatabricksDataType.SMALLINT,
sqlalchemy.types.TIMESTAMP: DatabricksDataType.TIMESTAMP,
sqlalchemy.types.JSON: DatabricksDataType.STRING,

@yunbodeng-db yunbodeng-db Sep 4, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Others with more knowledge can chime in, but I wonder if you need to do something similar to TinyIntegerTest to see if the type mapping will actually work. I think this addition makes sure the type will be recognized and translated, but I actually do not know how you would know the value is rendered as a literal string properly.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@kravets-levko

kravets-levko commented Sep 4, 2024

Copy link
Copy Markdown
Contributor

@jprakash-db Generally the idea you implemented looks correct - in Databricks, JSON values are stored as strings, so we have to give SQLAlchemy a hint about it. However, it would be nice to have tests to check that data are actually serialized correctly (as JSON-encoded string in this case). Currently we only have tests that verify it the type is mapped properly, but IMHO it's not enough. Can you please check if we have any tests to check that all our customized data types are actually properly serialized, and add JSON values to it? If we don't have such test suite - can you please create it, and it least check for JSON, Enum ans UUID types being properly serialized?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

kravets-levko
kravets-levko reviewed Sep 4, 2024
View reviewed changes
Comment thread src/databricks/sqlalchemy/_types.py
@compiles(sqlalchemy.types.JSON, "databricks")
def compile_string_databricks(type_, compiler, **kw):
"""
We override the default compilation for Enum(), String(), Text(), and Time() because SQLAlchemy

@kravets-levko kravets-levko Sep 4, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Please update this comment as well - to match decorators list for this function

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jprakash-db jprakash-db Sep 5, 2024

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

ok, adding this

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@peco-review-bot peco-review-bot Bot mentioned this pull request Nov 11, 2026
fix(kernel): honor use_cloud_fetch when opening sessions #1019
Open
4 tasks done

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@gopalldb gopalldb Awaiting requested review from gopalldb
@rcypher-databricks rcypher-databricks Awaiting requested review from rcypher-databricks
@andrefurlan-db andrefurlan-db Awaiting requested review from andrefurlan-db
@jackyhu-db jackyhu-db Awaiting requested review from jackyhu-db
@benc-db benc-db Awaiting requested review from benc-db
2 more reviewers
@kravets-levko kravets-levko kravets-levko left review comments
@yunbodeng-db yunbodeng-db yunbodeng-db left review comments
Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@jprakash-db jprakash-db

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@jprakash-db @kravets-levko @yunbodeng-db
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.