-
Notifications
You must be signed in to change notification settings - Fork 56
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
JSON Support for Alembic #263
Conversation
Can you please
|
Current behavior is that if your sqlalchemy model includes a JSON column and we are using alembic, trying to run a migration that adds a JSON columns results in Compiler <sqlalchemy_hana.dialect.HANATypeCompiler object at 0x14340ddd0> can't render element of type JSON |
Thanks a lot, also for the contribution. Can you let me know which alembic and Sqlalchemy version you use. I thought Sqlalchemy has some defaults or so regarding JSON |
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 add json_type
to test/requirements.py
with exclusions.open()
Okay, now we have some test failure with JSON. Can you please check them. Please let me know if you need any support |
Would need info on how to properly set up the tests locally against a HANA instance, otherwise this will be impossible to look into, as the tests that are executed seem to be sqlalchemy standard tests and as such I need to debug whats going on. On top of that, only basic JSON functionalities are ever going to be supported because HANA has no inherent notion of JSOn as a type (and hence JSONB based looksups like postgres offers are not available). This means that even if we fix this issue which currently fails all of the added tests, other tests such as test_index_typed_access and test_index_typed_comparison are probably never going to work, so we would need to skip them. EDIT: Seems I can run them via pytest test_sqlalchemy_dialect_suite.py --dburi hana://... |
@Zahlii do you have a HANA instance to work with? |
I currently only have access to an HDI container, but checking with our global account admin if we can get a user that can create schemas, as currently using HDI fails as we cannot create a random test schema inside of it with default user/pass |
@Zahlii if it's fine for you, I can also take over this part here. since you already contributed a lot 😄 |
I managed to reproduce it now with some tweaks, however for me the issue seems to be independent of JSON: CREATE TABLE data_table ( And then attempts the following INSERT FAILED [ 33%]INSERT INTO data_table (name, data, nulldata) VALUES (?, ?, ?) Which obviously cannot work, as the ID field is not filled... |
Good finding. Let me have a look! |
Open TODOs
|
Render JSON data type as NCLOB column. I am testing whether or not this automatically works also for SQLALCHEMY updates to JSON fields.