Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add JSON type compiler support#1130

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
SandeepAkode wants to merge6 commits intogoogleapis:main
base:main
Choose a base branch
Loading
fromSandeepAkode:add-json-type-compiler

Conversation

@SandeepAkode
Copy link

@SandeepAkodeSandeepAkode commentedOct 30, 2024
edited
Loading

Fixes#399 🦕

This commit handles JSON as column type. Currently it throws error for that and we can't use str() method on that column like column.type.

@SandeepAkodeSandeepAkode requested review froma team ascode ownersOctober 30, 2024 09:39
@product-auto-labelproduct-auto-labelbot added the size: xsPull request size is extra small. labelOct 30, 2024
@product-auto-labelproduct-auto-labelbot added the api: bigqueryIssues related to the googleapis/python-bigquery-sqlalchemy API. labelOct 30, 2024
@chalmerlowe
Copy link
Collaborator

chalmerlowe commentedOct 30, 2024
edited
Loading

Would it be possible for you to provide an example output based on having this new code?

i.e. being able to write sqlalchemy-based Python code with this new capability would allow us to generate SQL that looks like what?

A simple example would suffice so that I can quickly picture what we are trying to achieve that isn't currently possible?

I am in the middle of a couple of hot tasks, so I won't be able to come back to this for a day or two, but I am interested in getting this pushed through.

@chalmerlowechalmerlowe self-assigned thisOct 30, 2024
@chalmerlowechalmerlowe added kokoro:runAdd this label to force Kokoro to re-run the tests. owlbot:runAdd this label to trigger the Owlbot post processor. labelsOct 30, 2024
@gcf-owl-botgcf-owl-botbot removed the owlbot:runAdd this label to trigger the Owlbot post processor. labelOct 30, 2024
@yoshi-kokoroyoshi-kokoro removed the kokoro:runAdd this label to force Kokoro to re-run the tests. labelOct 30, 2024
@SandeepAkode
Copy link
Author

SandeepAkode commentedOct 30, 2024
edited
Loading

Here's an example. I created acustomers_info column

ALTER TABLE  `test_db.test_table` ADD COLUMN customer_info STRUCT<preferences JSON>;

I created a simple sqlalchemy engine and inspector. Then I got columns usinginspector.get_columns('test_db.test_table')
When we check the type of the column we added

>>> column['type']STRUCT(preferences=NullType())

Ideally it should beSTRUCT(preferences=JSON())

Also, if we try to usestr(column['type']) it will throw an error

sqlalchemy.exc.CompileError: Can't generate DDL for NullType(); did you forget to specify a type on this Column?

This is required as we might need to store column type as a string.

Thanks.

@chalmerlowechalmerlowe added kokoro:runAdd this label to force Kokoro to re-run the tests. owlbot:runAdd this label to trigger the Owlbot post processor. labelsNov 13, 2024
@gcf-owl-botgcf-owl-botbot removed the owlbot:runAdd this label to trigger the Owlbot post processor. labelNov 13, 2024
@yoshi-kokoroyoshi-kokoro removed the kokoro:runAdd this label to force Kokoro to re-run the tests. labelNov 13, 2024
@chalmerlowe
Copy link
Collaborator

@SandeepAkode

Thank you very much for your interest in this project and for your suggested change. Before we can approve and merge this PR, we will need to add tests. Is that something you are comfortable doing? If not that is fine, we have several options. If you want to add the tests but are not sure what that entails, we can provide guidance along the way. If you really don't feel comfortable, then let us know and we can put this into our backlog of tasks.

@chalmerlowe
Copy link
Collaborator

This is failing this test:

File "/tmpfs/src/github/python-bigquery-sqlalchemy/tests/unit/test_dialect_types.py", line 30, in test_types_import    assert getattr(dialect_module, type_name) == type_valueAttributeError: module 'sqlalchemy_bigquery' has no attribute 'JSON'|

@chalmerlowechalmerlowe added kokoro:runAdd this label to force Kokoro to re-run the tests. owlbot:runAdd this label to trigger the Owlbot post processor. labelsDec 2, 2024
@gcf-owl-botgcf-owl-botbot removed the owlbot:runAdd this label to trigger the Owlbot post processor. labelDec 2, 2024
@yoshi-kokoroyoshi-kokoro removed the kokoro:runAdd this label to force Kokoro to re-run the tests. labelDec 2, 2024
@chalmerlowe
Copy link
Collaborator

@SandeepAkode

This PR will need tests.
Right now,coverage the module we use to help ensure that we are providing test coverage of the code paths is failing.

If you are unsure how to proceed, let me know and I will provide some suggestions. If you don't have the bandwidth, I understand. Tell me so we can identify a path forward.

@mcallaway
Copy link

@SandeepAkode what's the status of this PR? Is anyone working on trying to get this merged?

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

Reviewers

@suzmuesuzmueAwaiting requested review from suzmuesuzmue was automatically assigned from googleapis/api-bigquery

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

Labels

api: bigqueryIssues related to the googleapis/python-bigquery-sqlalchemy API.size: xsPull request size is extra small.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Add support for JSON datatype

5 participants

@SandeepAkode@chalmerlowe@mcallaway@suzmue@yoshi-kokoro

[8]ページ先頭

©2009-2025 Movatter.jp