-
Notifications
You must be signed in to change notification settings - Fork 68
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
Querying #8
Comments
@rockwood Taking a look! |
@rockwood Could you show me the Post model definition? Also just to clarify, which versions of ecto/timex_ecto are you using? |
@rockwood It seems it's possible that the query builder is unable to infer the correct type of |
"ecto": {:hex, :ecto, "1.0.1"}, defmodule App.Post do
use App.Web, :model
schema "posts" do
field :submitted_at, Timex.Ecto.DateTime
end
end I tried switching to Thanks so much for taking a look. |
@rockwood There is a bug in Ecto's query planner that I found. José/Eric should be taking a look before long. I'll keep this thread updated as I hear more! |
This reverts back to standard Ecto.Datetimes because of an issue with Ecto.Query. See bitwalker/timex_ecto#8. It also removes the Repo from the VehicleQuery module
This reverts back to standard Ecto.Datetimes because of an issue with Ecto.Query. See bitwalker/timex_ecto#8. It also removes the Repo from the VehicleQuery module
I am encountering the same issue, any news? |
@mspanc Not yet, I had some ideas on the source of the issue, but haven't been able to delve into it to put together a fix + PR due to ElixirConf. I'll ping them again and see if they have any updates, but I'm guessing that it's been out of sight/out of mind for them since the issue was first reported. |
I too am facing this same issue. I tried converting to an Erlang |
This is a little ghetto, but is working for me until the bug is fixed. # By formatting to ISO the conversion to the Timex field works correctly.
january_1 = Date.from({2015, 1, 1}) |> DateFormat.format!("{ISO}")
from(s in Subscription, where: s.created_at >= ^january_1) P.S. I hope Timex becomes part of Elixir core at some point :) I think that would make things like this a lot simpler since there would be one common way of working with time |
Sorry this is such a pain in the ass everyone, the issue goes beyond just timex unfortunately, and needs to be addressed within ecto, but there hasn't been time for the ecto team to address it, and while I put together a simple patch which fixes it in ecto, it's probably not the right solution for the long term. I'll keep pushing to get a solution merged ASAP! |
Thanks @paulcsmith that's very helpful. The field in my model is an |
@bitwalker It's all good! This is complicated stuff and we know you and the Ecto team have tons to do :) My hope is that if Timex were merged into Elixir core, there would not be as many/any issues with Timex/Ecto interop. Who knows. Maybe one day! @CD1212 Glad I could help! |
This should be fixed as of timex_ecto 0.7.0 / ecto 1.1. Could you all test and verify that this is working for you? |
@bitwalker I've been a bit busy this week, but I'll check this out and post here if there are any issues! :D |
Using timex_ecto 0.7.0 / ecto 1.1 I get the following debug output: I don't have the UndefinedFunctionError but I believe the parameters are not converted correctly. Is it working for anyone? |
Nevermind. Looks like ecto dates output is the same. |
I'm using DateTimeWithTimezone, and this error happen:
I've tried DateTimeWithTimezone, Timezone, Datetime and can't get a query done successfully. It's possible to query using DateTimeWithTimezone or I need to convert for a simple date time format ? |
How is your schema defined? |
I'm having trouble querying by columns that use Timex.Ecto.DateTime. Is there something I'm doing wrong?
The text was updated successfully, but these errors were encountered: