#metabrainz

/

      • armalcolite
      • 2016-05-13 13415, 2016

      • alastairp
        the id is your timestamp, right?
      • 2016-05-13 13439, 2016

      • armalcolite
        yes
      • 2016-05-13 13451, 2016

      • armalcolite
        i wanted it to be consistent with cassandra db
      • 2016-05-13 13426, 2016

      • Gore
        can someone point me in the direction where I can find musicbrainz.org/release/add in https://github.com/metabrainz/musicbrainz-server ?
      • 2016-05-13 13428, 2016

      • alastairp
        right
      • 2016-05-13 13411, 2016

      • alastairp
        we could combine some of the rows, e.g. the year/month/day should be able to be changed to a Date or DateTime, or even removed
      • 2016-05-13 13417, 2016

      • alastairp
        this was for our partitioning
      • 2016-05-13 13435, 2016

      • alastairp
        if we're only storing partial data in postgres it's probably not as important
      • 2016-05-13 13453, 2016

      • alastairp
        but anyway, the error that you're getting? is that you don't want to be able to add an item twice?
      • 2016-05-13 13441, 2016

      • alastairp
        so your primary key says "A user can only insert 1 item at a given timestamp"
      • 2016-05-13 13452, 2016

      • armalcolite
        that is what we want right?
      • 2016-05-13 13426, 2016

      • armalcolite
        so if someone inserts a listen with same timestamp, we need to save the newer one.
      • 2016-05-13 13440, 2016

      • armalcolite
        that is what i am struggling to do. :(
      • 2016-05-13 13446, 2016

      • alastairp
        hmm
      • 2016-05-13 13446, 2016

      • armalcolite
        in postgresql
      • 2016-05-13 13453, 2016

      • alastairp
        actually - I'm not sure
      • 2016-05-13 13458, 2016

      • alastairp
        what if we just ignored it?
      • 2016-05-13 13414, 2016

      • armalcolite
        currently i am doing the same.
      • 2016-05-13 13427, 2016

      • armalcolite
        actually the code in that branch is working, if someone want to test
      • 2016-05-13 13433, 2016

      • armalcolite
        *wants
      • 2016-05-13 13408, 2016

      • alastairp
        were you trying with INSERT ... ON CONFLICT ... ?
      • 2016-05-13 13429, 2016

      • armalcolite
      • 2016-05-13 13448, 2016

      • alastairp
        Gore: someone will get to you soon. the main server developers are still sleeping
      • 2016-05-13 13400, 2016

      • Gore
        alastairp thanks :)
      • 2016-05-13 13426, 2016

      • alastairp
        armalcolite: I think you should have a separate PostgresListenStore and CassandraListenStore
      • 2016-05-13 13443, 2016

      • alastairp
        so that we can swap them in and out with just 1 line
      • 2016-05-13 13434, 2016

      • alastairp
        also, the method shouldn't be insert_async_postgres - the async is because of a feature of cassandra. This doesn't exist in postgres so it doesn't make sense to call it that
      • 2016-05-13 13400, 2016

      • armalcolite
        yeah, a lot of changes have to be done.
      • 2016-05-13 13407, 2016

      • armalcolite
        this is just the initial commit. :)
      • 2016-05-13 13424, 2016

      • alastairp
        you should use sqlalchemy to connect to the database. we already have it in some places in LB for the user accounts
      • 2016-05-13 13424, 2016

      • kanha has quit
      • 2016-05-13 13437, 2016

      • alastairp
        it gives us much easier transaction control than just having psycopg2
      • 2016-05-13 13401, 2016

      • alastairp
        but that looks good
      • 2016-05-13 13406, 2016

      • armalcolite
        regarding separate ListenStore, there are a lot of common functions. Then, should i remove them from class?
      • 2016-05-13 13419, 2016

      • alastairp
        you can have a parent class ListenStore
      • 2016-05-13 13423, 2016

      • alastairp
        for the common functions
      • 2016-05-13 13429, 2016

      • armalcolite
        sure. :)
      • 2016-05-13 13432, 2016

      • alastairp
        and subclasses for the backend-specific code
      • 2016-05-13 13433, 2016

      • kanha joined the channel
      • 2016-05-13 13401, 2016

      • alastairp
        I'm going to lunch
      • 2016-05-13 13451, 2016

      • armalcolite
        alastairp: please review the existing PR's whenever u get time.
      • 2016-05-13 13453, 2016

      • ruaok
        yah, I need food too. Are you going to be around in 2 hours armalcolite ?
      • 2016-05-13 13410, 2016

      • armalcolite
        ruaok: sure. :)
      • 2016-05-13 13415, 2016

      • ruaok
        ok, cool.
      • 2016-05-13 13432, 2016

      • ruaok
        zas and I are done with the most important work of the day, so I can focus on some LB stuff this afternoon.
      • 2016-05-13 13448, 2016

      • MajorLurker has quit
      • 2016-05-13 13444, 2016

      • Freso
        armalcolite: Can I make a request? Don't use pastebin.com. :) There are plenty of other sites with none of the issues that pastebin.com has: https://wiki.archlinux.org/index.php/List_of_appl…
      • 2016-05-13 13415, 2016

      • armalcolite
        Freso: oh. sure.
      • 2016-05-13 13407, 2016

      • armalcolite
        Freso: That list is really awsome, specially, https://ptpb.pw
      • 2016-05-13 13421, 2016

      • Freso
        I use ptpb.pw most of the time. :)
      • 2016-05-13 13428, 2016

      • armalcolite
        Freso: have been looking for something like that since a long time. (was planning to make one)
      • 2016-05-13 13438, 2016

      • Freso
        Well, that and gist.
      • 2016-05-13 13411, 2016

      • Freso
        ptpb.pw when I just want to toss things out there, and Gist when I want to have a bit more control.
      • 2016-05-13 13443, 2016

      • armalcolite
        some provide API access, so i was planning to make one. You saved my time. :)
      • 2016-05-13 13443, 2016

      • UmkaDK_ joined the channel
      • 2016-05-13 13448, 2016

      • Freso
        (Gists are Git version controlled, so I can clone a gist locally and work on it, and since (non-anonymous) gists are tied to my GitHub account, I can also delete them later.)
      • 2016-05-13 13404, 2016

      • Freso
        armalcolite: That's what FOSS is all about, no? :p
      • 2016-05-13 13420, 2016

      • armalcolite
        Freso: yeah, i spent a lot of time in making one for imgur. :P
      • 2016-05-13 13441, 2016

      • armalcolite
        Freso: sometimes you can't help when ideas overload your mind.
      • 2016-05-13 13445, 2016

      • armalcolite
        :P
      • 2016-05-13 13445, 2016

      • Freso
        Mhm.
      • 2016-05-13 13402, 2016

      • armalcolite
      • 2016-05-13 13456, 2016

      • UmkaDK has quit
      • 2016-05-13 13452, 2016

      • chrisskye
        Freso: yes. videolan is in the system
      • 2016-05-13 13419, 2016

      • chrisskye
        logo should be put up on the page...
      • 2016-05-13 13441, 2016

      • chrisskye
        Gentlecat: can you post the Videolan logo...it is there in there registration account
      • 2016-05-13 13410, 2016

      • chrisskye
        fre
      • 2016-05-13 13440, 2016

      • chrisskye
        Freso: we just need a one line description to post below the logo, describing how they use MB
      • 2016-05-13 13459, 2016

      • Freso
        chrisskye: "thresh | Freso, VLC uses Musicbrainz data to lookup releases to find corresponding album art"
      • 2016-05-13 13431, 2016

      • Freso
        Actually, hold that.
      • 2016-05-13 13413, 2016

      • Freso
        chrisskye: "thresh | "VLC uses MusicBrainz for looking up CD data as well as finding cover art for releases.""
      • 2016-05-13 13426, 2016

      • Freso
        Possibly "to look up CD data".
      • 2016-05-13 13442, 2016

      • Freso
        And "VLC media player".
      • 2016-05-13 13447, 2016

      • Freso
        So.
      • 2016-05-13 13420, 2016

      • Freso
        "VLC media player uses MusicBrainz (for looking/to look) up CD data as well as finding cover art for releases."
      • 2016-05-13 13434, 2016

      • Freso
        chrisskye: ^ does that work?
      • 2016-05-13 13447, 2016

      • Freso relaying conversation between two IRC channels :p
      • 2016-05-13 13418, 2016

      • chrisskye
        hahahah Pick one, and then we have to kindly ask Gentlcat or ruaok to post it.
      • 2016-05-13 13422, 2016

      • chrisskye
        last version then?
      • 2016-05-13 13426, 2016

      • Freso
        chrisskye: The last one.
      • 2016-05-13 13428, 2016

      • Freso
        Yeah.
      • 2016-05-13 13403, 2016

      • Freso
        chrisskye: None of the involved parties, except for you, seem to be native English speakers. So you get to pick between "for looking" and "to look" :)
      • 2016-05-13 13424, 2016

      • chrisskye
        done. :)
      • 2016-05-13 13433, 2016

      • chrisskye
        spent all morning and part of yesterday afternoon doing Spanish bureaucracy...and in the interim we had 5 new sign-ups!
      • 2016-05-13 13446, 2016

      • Freso
        Wow. Nice. :)
      • 2016-05-13 13451, 2016

      • chrisskye
        And, at least half are offering money.
      • 2016-05-13 13408, 2016

      • Freso
        At least half... of 5. :p
      • 2016-05-13 13420, 2016

      • chrisskye
        ...writing back, means, writing back and forth... So...like all things in this country...I’m behind on my work!!!
      • 2016-05-13 13453, 2016

      • Freso
        "When in Rome, do as the Romans", sí?
      • 2016-05-13 13454, 2016

      • chrisskye
        hehehe...I counted the mobile level ($10) and a semi
      • 2016-05-13 13422, 2016

      • chrisskye
        as
      • 2016-05-13 13444, 2016

      • chrisskye
        ...but glancing at the one, I think they should pay more...which means a long letter
      • 2016-05-13 13450, 2016

      • chrisskye
        so it goes
      • 2016-05-13 13434, 2016

      • D4RK-PH0ENiX has quit
      • 2016-05-13 13426, 2016

      • ruaok wonders how he missed thresh signing up
      • 2016-05-13 13434, 2016

      • ruaok
        clearly I approved it.
      • 2016-05-13 13418, 2016

      • ruaok
        alastairp, armalcolite: I'm thinking about the replacement semantics for the UPSERT.
      • 2016-05-13 13437, 2016

      • ruaok
        ignore seems like a valid mode -- first write will stay.
      • 2016-05-13 13450, 2016

      • ruaok
        if that seems like something that needs changing, we can change it later with no real impact on the database.
      • 2016-05-13 13409, 2016

      • ruaok
        armalcolite: you code works with ignore right now, right? if so, then we're good to go with that.
      • 2016-05-13 13420, 2016

      • armalcolite
        ruaok: yeah. it works fine
      • 2016-05-13 13429, 2016

      • ruaok
        ok, then leave it be for now.
      • 2016-05-13 13451, 2016

      • ruaok
        regarding the "id" column naming.
      • 2016-05-13 13415, 2016

      • ruaok
        while I appreciate you wanting to keep things in sync with the cassandra bit, it conflicts with our existing conventions used in postgres.
      • 2016-05-13 13408, 2016

      • alastairp
        ruaok: right, I think we should think about this is a day-to-day system
      • 2016-05-13 13419, 2016

      • alastairp
        if an app submits twice, it's an error
      • 2016-05-13 13427, 2016

      • alastairp
        if the app made an error submitting, we should delete it
      • 2016-05-13 13448, 2016

      • ruaok
        I think we should change the id field to be "ts TIMESTAMP WITH TIMEZONE"
      • 2016-05-13 13450, 2016

      • Freso
        ruaok: :)
      • 2016-05-13 13459, 2016

      • ruaok
        and remove the day, month, year columns. they are not needed.
      • 2016-05-13 13416, 2016

      • alastairp
        sounds good to me
      • 2016-05-13 13419, 2016

      • armalcolite
        ruaok: ok.
      • 2016-05-13 13434, 2016

      • armalcolite
        alastairp: i also separated the classes. have a look.
      • 2016-05-13 13443, 2016

      • alastairp
        perhaps we should do our standard AB table split here too
      • 2016-05-13 13448, 2016

      • ruaok
        alastairp: the problem with throwing an error that it is hard to give a meaningful error message.
      • 2016-05-13 13452, 2016

      • alastairp
        put the json in a different table
      • 2016-05-13 13403, 2016

      • ruaok
        if you have 1000 listens to submit you have no idea which row was the offending one.
      • 2016-05-13 13403, 2016

      • alastairp
        ruaok: oh, I didn't mean report the error
      • 2016-05-13 13411, 2016

      • armalcolite
      • 2016-05-13 13412, 2016

      • alastairp
        I meant to say "the app made an error and we should ignore it"
      • 2016-05-13 13424, 2016

      • alastairp
        armalcolite: you should open this as a pull request
      • 2016-05-13 13429, 2016

      • alastairp
        don't worry if it's not finished
      • 2016-05-13 13429, 2016

      • ruaok
        ah. which then is an argument for "the current setup is fine", yes?
      • 2016-05-13 13439, 2016

      • alastairp
        it just makes it easier for us to comment on it
      • 2016-05-13 13441, 2016

      • armalcolite
        alastairp: ok. will do.
      • 2016-05-13 13444, 2016

      • alastairp
        ruaok: yes, that's what I wanted to say
      • 2016-05-13 13449, 2016

      • ruaok
        current setup being UPSET with ignore.
      • 2016-05-13 13451, 2016

      • ruaok
        fabu.
      • 2016-05-13 13401, 2016

      • ruaok
        UPSET. :)
      • 2016-05-13 13402, 2016

      • alastairp
        i'm so UPSET
      • 2016-05-13 13411, 2016

      • alastairp
        sounds like MeB
      • 2016-05-13 13419, 2016

      • github joined the channel
      • 2016-05-13 13420, 2016

      • github
        [listenbrainz-server] pinkeshbadjatiya opened pull request #80: Migrate to postgres (master...migrate-to-postgres) https://github.com/metabrainz/listenbrainz-server…
      • 2016-05-13 13420, 2016

      • github has left the channel
      • 2016-05-13 13456, 2016

      • armalcolite
        alastairp: is this what you were talking about? https://github.com/metabrainz/listenbrainz-server…
      • 2016-05-13 13439, 2016

      • alastairp
        I'll need to look at it in more detail
      • 2016-05-13 13452, 2016

      • armalcolite
        alastairp: sure.
      • 2016-05-13 13423, 2016

      • armalcolite
        alastairp: and please skip 'print' comments, i will remove them by tomorrow. :)
      • 2016-05-13 13451, 2016

      • armalcolite
        alastairp: i left a lot of 'print's to test stuff. that is the reason i did not put up a PR.
      • 2016-05-13 13424, 2016

      • armalcolite
        also, i am not sure if this was intended, but the table name in postgres is '"user"' not 'user'
      • 2016-05-13 13444, 2016

      • alastairp
        right - but if you make a commit then you still need to remove it in another commit
      • 2016-05-13 13458, 2016

      • alastairp
        it would be better to not commit it in the first place
      • 2016-05-13 13404, 2016

      • alastairp
        git add -p is useful here
      • 2016-05-13 13421, 2016

      • alastairp
        right. user is a reserved word in postgres, so you need to surround it in "" quotes
      • 2016-05-13 13422, 2016

      • diana_olhovyk_ has quit
      • 2016-05-13 13440, 2016

      • alastairp
        I'm not super happy with the choice, because it adds complexity
      • 2016-05-13 13414, 2016

      • armalcolite
        oh, i was not aware of that. :)
      • 2016-05-13 13427, 2016

      • Freso
        git add/commit -p is ❤️
      • 2016-05-13 13446, 2016

      • alastairp
        you can make a table called `select` if you want