-
Notifications
You must be signed in to change notification settings - Fork 13
embeds_many not supported #225
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
Comments
We probably need to be able to support something like this but it might get tricky due to possible ambiguity (is it a JSON, is it a Nested table, or something else entirely). And you are right, we kind of skipped it during development since this wasn't useful for us. Note however, that Plausible is using nested tables for metadata fields in events and sessions tables and they are represented as just arrays. Seems to work there. I wonder if it could be used as a workaround while we are figuring out the embedded schemas? schema "standards_usage" do
# ...
field :"standards.standard_id", {:array, Ch}, type: "FixedString(32)"
# ...
end |
@ruslandoga Thank you! I'm still running into an issue when I try to create the struct: %Spikey.StandardsUsage{
standards: standards,
} I get the compile message:
When I try to use a changset to cast (similar to how you do it here), it doesn't seem to capture that this is an array: |> cast(
%{
standards: card_stack.standards
},
[:"standards.standard_id"]
)
|> apply_changes() produces %{
"standards.jurisdiction_id": nil,
"standards.jurisdiction_title": nil,
"standards.standard_id": nil,
"standards.standard_set_id": nil,
"standards.standard_set_title": nil,
} it should look like: %{
standards: [
jurisdiction_id: "asfasd",
# ...snip...
]
} In the examples from Plausible, I'm not seeing where you all set Any ideas how to get around that part? How do I populate the field? |
Maybe something like this: ids = ["11111111111111111111111111111111", "11111111111111111111111111111111",
"11111111111111111111111111111111", "11111111111111111111111111111111",
"11111111111111111111111111111111"]
%Spikey.StandardsUsage{
"standards.standard_id": ids
} And for casting you would need to use the "full" column name, like |> cast(
%{
# it can probably be made prettier, but this should work too
"standards.standard_id": Enum.map(card_stack.standards, & &1.standard_id)
},
[:"standards.standard_id"]
)
|> apply_changes() |
@ruslandoga that worked! You're a life saver. Thank you! |
Hi! I really appreciate the library, but we're running into an issue where we can't used embedded documents. It seems those schemas aren't used in this library's tests and/or are commented out, so this might be something that's not supported or in development. Here's what we're seeing:
Here's our schema:
Here's our model:
and the embedded model look like this:
When we insert, we get:
I go to
lib/ecto/adapters/clickhouse/schema.ex:333
and log the arguments:I get
It appears that the
embeds_many
is being converted to{:map, :any}
. How can we add support for inserted embedded documents in this adapter?Thanks in advance for any insight you have here!
The text was updated successfully, but these errors were encountered: