#elixir-lang

/

      • -- BotBot disconnected, possible missing messages --
      • -- BotBot disconnected, possible missing messages --
      • [0__0] joined the channel
      • NOTICE: [freenode-info] channel trolls and no channel staff around to help? please check with freenode support: http://freenode.net/faq.shtml#gettinghelp
      • Uniaika joined the channel
      • fishcakez_
        it should be after, otherwise time can change between the two calls and be missed
      • lexmag
        right
      • akovari has quit
      • before
      • argh
      • nazarsh_ joined the channel
      • after, after
      • fishcakez_
        why before?
      • enk0 joined the channel
      • d42 has quit
      • janvereecken has quit
      • aarontrostle joined the channel
      • this is why i think we need better docs so we show the common patterns
      • gonz_ has quit
      • lexmag
        totally agree
      • hugdubois has quit
      • hitoridewanai joined the channel
      • fishcakez_
        the docs you referenced early say that its important monotonic time is first so must be missing something
      • nk0 has quit
      • lexmag
        I'm trying hard to find why
      • and can't :(
      • nazarsh has quit
      • fishcakez_
        but both values are monotonic so order is guaranteed either way
      • lexmag
        right, except monotonic_time isn't strict
      • but it is not a problem when `unique_integer([monotonic])`
      • in use
      • fishcakez_
        ok I think i get it
      • aarontrostle has quit
      • if you have {unique_integer, monotonic_time or any time} the time values are not guaranteed to be in order
      • the only way to order in time is to have monotonic_time as the first value
      • lexmag
        right
      • not absolute order
      • but order in time
      • fishcakez_
        whats aboslute order?
      • daemol has quit
      • oh you mean opposed to real monotonic tiime
      • lexmag
        absolute order if unique_integer at first
      • bcardarella
        can Ecto's fragment function be used to run custom functions that return queries?
      • d42 joined the channel
      • fishcakez_
        so if you have an ets ordered_set or similar datastructure you want to key to be ordered by monotonic time to select the events occurring in a certain time period - otherwise you have to do full table scan
      • jschneck has quit
      • and then you can get an approximation of the absolute time using the off_set optimisation you mentioned?
      • bcardarella
        for example, I would call my custom function in psql with: "select * from my_func();" I'm not quite sure how to express this in Ecto's query builder, let alone how to compose additional queries on top of it
      • lexmag
        fishcakez_: yes
      • nazarsh_ has quit
      • ordered_set, maybe processing in batch
      • who knows what the real need could be
      • wless1 joined the channel
      • wless1 has quit
      • but is is useful
      • datanoise joined the channel
      • chnyda has quit
      • mylanconnolly joined the channel
      • mylanconnolly has quit
      • mylanconnolly joined the channel
      • [0__0] joined the channel
      • benwilson512
        trigun0x2: yeah I mean I'd just put lib/my_app/models and put your models in there
      • revdan has quit
      • trigun0x2
        benwilson512: alright then
      • just wondering if there's a best practice of sorts
      • jschneck has quit
      • benwilson512
        well, the convention has been largely derived from phoenix
      • phoenix puts them outside lib due to code reloading concerns
      • but
      • if that isn't something you're doing, putting them in lib would be the convention
      • gazler
        I have a non-phoenix ecto project with models inside lib/my_app/models as benwilson512 is suggesting
      • So 2 people makes it a convention, right?
      • sorentwo
        I'm just amazed you are both trying to make `my_app` =)
      • Talk about convention.
      • trigun0x2
        gazler: i guess :P
      • Elixir convention: "Name project my_app"
      • paulcsmith_ has quit
      • gazler
        I'm surprised nobody has that package on hex.
      • trigun0x2
        If I just add the schema for a DB that was previously populated
      • Everything should just work right?
      • Hopefully..
      • gazler
        trigun0x2: You mean the DB was populated outside of ecto?
      • matthewphilyaw has quit
      • trigun0x2
        gazler: yup
      • gazler
        trigun0x2: Yeah, your schema just needs to match.
      • sorentwo
        It sounds like he is trying to point at a db that is created/owned by Rails
      • paulcsmith_ joined the channel
      • trigun0x2
        Yup
      • skol_ has quit
      • gazler
        trigun0x2: Migrations go in `priv/repo/migrations` if you do want them.
      • trigun0x2
        I'm just trying to access one table for now. For testing
      • sorentwo
        trigun0x2: Keep in mind that the timestamps don't match up, created_at in Rails, inserted_at in Ecto.
      • clarkkampfe has quit
      • trigun0x2
        sorentwo: so I'll just have to name it created_at, does Ecto do anything special with the timestamps?
      • mayp has quit
      • sorentwo: would the time not be an Ecto.Date?
      • sorentwo
        trigun0x2: It will parse them just fine if you specify as Ecto.DateTime
      • [0__0] has quit
      • -- BotBot disconnected, possible missing messages --
      • [0__0] joined the channel
      • ananthakumaran has quit
      • MarioFlach
        micmus: Yes, i fixed that. Due to a lot of testing and trying...
      • micmus: Now, my code got into the execute/6 function. But still crashing.
      • micmus
        MarioFlach: translating queries is probably the toughest part of writing an ecto adapter
      • trigun0x2
        quick question. In https://github.com/elixir-lang/ecto/blob/master... why do they defmodule Simple.App?
      • that's the point of that module
      • I see it starts a Supervisor but the app just does queries
      • linc01n has quit
      • linc01n joined the channel
      • codestorm has quit
      • MarioFlach
        micmus: Yes. Kind of stuck with thoses Ecto queries.
      • micmus: %{assocs: [], prefix: nil, preloads: [],
      • select: %Ecto.Query.SelectExpr{expr: {:&, [], [0]}, fields: [{:&, [], [0]}],
      • file: nil, line: nil, params: %{}}, sources: {{"users", Hello.User}}}
      • micsmus: {:all, #Ecto.Query<from u in Hello.User, where: u.id == ^..., select: u>}
      • micmus: But the Ecto.Repo is also a behaviour. Would be easier to impl. the code there.
      • lexmag joined the channel
      • micmus
        MarioFlach: but it does much, much more then just go to repo
      • MarioFlach
        micmus: =) Yes, all the cool changeset things i would like to have
      • micmus
        MarioFlach: It does associations, callbacks, autogeneration, and many more features
      • And it's hard te separate it from queries - that's the point of ecto, to have a unified query interface
      • stoft joined the channel
      • lechindianer joined the channel
      • It's not as big of a win with applications (you don't have to write SQL), but it's biggest win for libraries - they don't have to care what database you are using
      • ericmj
        why is it so hard for rethink to map to ecto queries when it worked pretty well for mongo
      • it doesn't cover 100% of cases but it is good enough
      • agit0 joined the channel
      • i would say our mongo application at work is 95% ecto queries, rest is mongo and that's because we use aggregations quite a bit
      • it is really easy to drop down to mongo queries when you have to
      • micmus
        ericmj: I think the biggest problem is that it's quite some work to translate it ;)
      • mylanconnolly joined the channel
      • ideuler joined the channel
      • But yeah, for most cases ecto queries work perfectly
      • MarioFlach
        micmus: Thx for the help. Will try to get further another day =)
      • ericmj
        micmus: eh, some guy that did over a summer for mongo ;)
      • jkreeftmeijer joined the channel
      • vt joined the channel
      • colleenmcguckin joined the channel
      • lacuna has quit
      • hitoridewanai has quit
      • MarioFlach
        ericmj: I started to look @ the MongoDB Ecto impl.
      • lacuna joined the channel
      • lacuna has quit
      • lacuna joined the channel
      • jschneck joined the channel
      • ericmj: But i then wanted to use things more ReQLy. The RethinkDB Elixir driver has implemented a nice API to work with.
      • ericmj: table("artists") |> filter(...) |> map(...) |> Repo.run
      • colleenmcguckin has quit
      • colleenmcguckin joined the channel