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

setting allow_experimental_object_type to migrate JSON type fields to Clickhouse DB #170

Open
samanshahroudi opened this issue Apr 21, 2024 · 4 comments
Assignees

Comments

@samanshahroudi
Copy link

Your Question

How can I set the allow_experimental_object_type value before creating a table in Clickhouse DB using go-gorm library?

The document you expected this should be explained

I need to have a field of type Json in the Golang structure. According to this document https://clickhouse.com/docs/en/integrations/data-formats/json, I need to set the allow_experimental_object_type value to 1 before creating a table, but I couldn't find a way to set it using the go-gorm library.

Expected answer

I need a code snippet or a small workaround to set allow_experimental_object_type to 1 using go-gorm library, so I can automatically migrate the Golang struct to the Clickhouse table with the JSON field.

@samanshahroudi samanshahroudi changed the title setting allow_experimental_object_type setting allow_experimental_object_type to migrate JSON type fields to Clickhouse DB Apr 21, 2024
@mr-tron
Copy link

mr-tron commented May 13, 2024

err = conn.Exec("set allow_experimental_object_type = 1").AutoMigrate(objects...)

@xuchen81
Copy link

xuchen81 commented Aug 7, 2024

having the same question, anyone can help?

@xuchen81
Copy link

xuchen81 commented Aug 7, 2024

err = conn.Exec("set allow_experimental_object_type = 1").AutoMigrate(objects...)

it does not work.

@movy
Copy link

movy commented Dec 13, 2024

Same happening on Clickhouse Cloud:
image

Very frustrating, but also hilarious since Clickhouse Cloud AI offered this query and failed to fix the error. So much for fancy blog posts....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants