)]}'
{"marconi/queues/storage/sqlalchemy/shards.py":[{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"647d24ee4d67d5390ed153e62d4e48a7d4713c59","unresolved":false,"context_lines":[{"line_number":1,"context_line":"# Copyright (c) 2013 Rackspace, Inc."},{"line_number":2,"context_line":"#"},{"line_number":3,"context_line":"# Licensed under the Apache License, Version 2.0 (the \"License\");"},{"line_number":4,"context_line":"# you may not use this file except in compliance with the License."}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAUX%2F%2FZwQ%3D","line":1,"updated":"2014-02-13 13:29:31.000000000","message":"2014*","commit_id":"434be947d768c5182ef3701d1e5d2b1604663333"},{"author":{"_account_id":6944,"name":"Allele Dev","email":"cpp.cabrera@gmail.com","username":"cpp-cabrera"},"change_message_id":"bf067d2c910dcf3fb4d8fba3c0cbb8fd42ba8cba","unresolved":false,"context_lines":[{"line_number":1,"context_line":"# Copyright (c) 2013 Rackspace, Inc."},{"line_number":2,"context_line":"#"},{"line_number":3,"context_line":"# Licensed under the Apache License, Version 2.0 (the \"License\");"},{"line_number":4,"context_line":"# you may not use this file except in compliance with the License."}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAUX%2F%2B03A%3D","line":1,"in_reply_to":"AAAAUX%2F%2FZwQ%3D","updated":"2014-02-18 19:18:48.000000000","message":"Thanks! Fixed.","commit_id":"434be947d768c5182ef3701d1e5d2b1604663333"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"647d24ee4d67d5390ed153e62d4e48a7d4713c59","unresolved":false,"context_lines":[{"line_number":40,"context_line":"    def __init__(self, *args, **kwargs):"},{"line_number":41,"context_line":"        super(ShardsController, self).__init__(*args, **kwargs)"},{"line_number":42,"context_line":""},{"line_number":43,"context_line":"        self._conn \u003d self.driver.connection"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"    def list(self, marker\u003dNone, limit\u003d10, detailed\u003dFalse):"},{"line_number":46,"context_line":"        marker \u003d marker or \u0027\u0027"}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAUX%2F%2FZyo%3D","line":43,"updated":"2014-02-13 13:29:31.000000000","message":"In a follow up patch, I\u0027d like to see this controller using `self.driver.run` and `self.trans`","commit_id":"434be947d768c5182ef3701d1e5d2b1604663333"},{"author":{"_account_id":6944,"name":"Allele Dev","email":"cpp.cabrera@gmail.com","username":"cpp-cabrera"},"change_message_id":"bf067d2c910dcf3fb4d8fba3c0cbb8fd42ba8cba","unresolved":false,"context_lines":[{"line_number":40,"context_line":"    def __init__(self, *args, **kwargs):"},{"line_number":41,"context_line":"        super(ShardsController, self).__init__(*args, **kwargs)"},{"line_number":42,"context_line":""},{"line_number":43,"context_line":"        self._conn \u003d self.driver.connection"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"    def list(self, marker\u003dNone, limit\u003d10, detailed\u003dFalse):"},{"line_number":46,"context_line":"        marker \u003d marker or \u0027\u0027"}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAUX%2F%2B08M%3D","line":43,"in_reply_to":"AAAAUX%2F%2FZyo%3D","updated":"2014-02-18 19:18:48.000000000","message":"+1 - I\u0027ll make those mods in the near future.","commit_id":"434be947d768c5182ef3701d1e5d2b1604663333"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"647d24ee4d67d5390ed153e62d4e48a7d4713c59","unresolved":false,"context_lines":[{"line_number":93,"context_line":"        fields \u003d common_utils.fields(kwargs, names,"},{"line_number":94,"context_line":"                                     pred\u003dlambda x: x is not None)"},{"line_number":95,"context_line":""},{"line_number":96,"context_line":"        assert fields, \u0027`weight`, `uri`, or `options` not found in kwargs\u0027"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":"        if \u0027options\u0027 in fields:"},{"line_number":99,"context_line":"            fields[\u0027options\u0027] \u003d json.dumps(fields[\u0027options\u0027])"}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAUX%2F%2FZxc%3D","line":96,"updated":"2014-02-13 13:29:31.000000000","message":"I\u0027d prefer using real exceptions instead of assertions, thoughts?","commit_id":"434be947d768c5182ef3701d1e5d2b1604663333"},{"author":{"_account_id":6944,"name":"Allele Dev","email":"cpp.cabrera@gmail.com","username":"cpp-cabrera"},"change_message_id":"bf067d2c910dcf3fb4d8fba3c0cbb8fd42ba8cba","unresolved":false,"context_lines":[{"line_number":93,"context_line":"        fields \u003d common_utils.fields(kwargs, names,"},{"line_number":94,"context_line":"                                     pred\u003dlambda x: x is not None)"},{"line_number":95,"context_line":""},{"line_number":96,"context_line":"        assert fields, \u0027`weight`, `uri`, or `options` not found in kwargs\u0027"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":"        if \u0027options\u0027 in fields:"},{"line_number":99,"context_line":"            fields[\u0027options\u0027] \u003d json.dumps(fields[\u0027options\u0027])"}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAUX%2F%2B050%3D","line":96,"in_reply_to":"AAAAUX%2F%2FZxc%3D","updated":"2014-02-18 19:18:48.000000000","message":"Hmm... this got me thinking.\n\nThe correct place to handle this is at the API layer: https://github.com/openstack/marconi/blob/master/marconi/queues/transport/wsgi/shards.py#L178\n\nAnd it\u0027s already handled! So, I\u0027m happy with the assertion, since it would indicate that something was broken above.","commit_id":"434be947d768c5182ef3701d1e5d2b1604663333"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"647d24ee4d67d5390ed153e62d4e48a7d4713c59","unresolved":false,"context_lines":[{"line_number":110,"context_line":"        self._conn.execute(stmt)"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"    def drop_all(self):"},{"line_number":113,"context_line":"        stmt \u003d sa.sql.expression.delete(tables.Shards)"},{"line_number":114,"context_line":"        self._conn.execute(stmt)"},{"line_number":115,"context_line":""},{"line_number":116,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAUX%2F%2FZwk%3D","line":113,"updated":"2014-02-13 13:29:31.000000000","message":"Sounds like this could be expensive, couldn\u0027t it?\n\nNot sure if there\u0027s a better way to do it, though.","commit_id":"434be947d768c5182ef3701d1e5d2b1604663333"},{"author":{"_account_id":6944,"name":"Allele Dev","email":"cpp.cabrera@gmail.com","username":"cpp-cabrera"},"change_message_id":"bf067d2c910dcf3fb4d8fba3c0cbb8fd42ba8cba","unresolved":false,"context_lines":[{"line_number":110,"context_line":"        self._conn.execute(stmt)"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"    def drop_all(self):"},{"line_number":113,"context_line":"        stmt \u003d sa.sql.expression.delete(tables.Shards)"},{"line_number":114,"context_line":"        self._conn.execute(stmt)"},{"line_number":115,"context_line":""},{"line_number":116,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAUX%2F%2B05g%3D","line":113,"in_reply_to":"AAAAUX%2F%2FZwk%3D","updated":"2014-02-18 19:18:48.000000000","message":"It will be expensive. Mostly, I\u0027m expecting drop_all to be used for tests, so I think it\u0027ll be okay.","commit_id":"434be947d768c5182ef3701d1e5d2b1604663333"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"647d24ee4d67d5390ed153e62d4e48a7d4713c59","unresolved":false,"context_lines":[{"line_number":114,"context_line":"        self._conn.execute(stmt)"},{"line_number":115,"context_line":""},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"def _normalize(shard, detailed\u003dFalse):"},{"line_number":118,"context_line":"    ret \u003d {"},{"line_number":119,"context_line":"        \u0027name\u0027: shard[0],"},{"line_number":120,"context_line":"        \u0027uri\u0027: shard[1],"}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAUX%2F%2FZwU%3D","line":117,"updated":"2014-02-13 13:29:31.000000000","message":"I might be wrong but, is this utility being copied around? I think I saw it in the mongodb implementation.","commit_id":"434be947d768c5182ef3701d1e5d2b1604663333"},{"author":{"_account_id":6944,"name":"Allele Dev","email":"cpp.cabrera@gmail.com","username":"cpp-cabrera"},"change_message_id":"bf067d2c910dcf3fb4d8fba3c0cbb8fd42ba8cba","unresolved":false,"context_lines":[{"line_number":114,"context_line":"        self._conn.execute(stmt)"},{"line_number":115,"context_line":""},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"def _normalize(shard, detailed\u003dFalse):"},{"line_number":118,"context_line":"    ret \u003d {"},{"line_number":119,"context_line":"        \u0027name\u0027: shard[0],"},{"line_number":120,"context_line":"        \u0027uri\u0027: shard[1],"}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAUX%2F%2B05Y%3D","line":117,"in_reply_to":"AAAAUX%2F%2FZwU%3D","updated":"2014-02-18 19:18:48.000000000","message":"It\u0027s not being copied. :)\n\nA function like _normalize is defined in a few places. It\u0027s a little different each time.","commit_id":"434be947d768c5182ef3701d1e5d2b1604663333"},{"author":{"_account_id":6427,"name":"Kurt Griffiths","email":"kurt.griffiths@rackspace.com","username":"kgriffs"},"change_message_id":"fd86be3b65f2af676ae13fcf683f578c73a4eb31","unresolved":false,"context_lines":[{"line_number":42,"context_line":""},{"line_number":43,"context_line":"        self._conn \u003d self.driver.connection"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"    def list(self, marker\u003dNone, limit\u003d10, detailed\u003dFalse):"},{"line_number":46,"context_line":"        marker \u003d marker or \u0027\u0027"},{"line_number":47,"context_line":"        stmt \u003d sa.sql.select([tables.Shards]).where("},{"line_number":48,"context_line":"            tables.Shards.c.name \u003e marker"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAUX%2F%2B9tg%3D","line":45,"updated":"2014-02-17 23:54:04.000000000","message":"The body of this could use some whitespace to group related statements and make the code easier to read.","commit_id":"c0dbe7038e0e0519ec8df6ed5dbc25ee951d53b4"},{"author":{"_account_id":6944,"name":"Allele Dev","email":"cpp.cabrera@gmail.com","username":"cpp-cabrera"},"change_message_id":"aa29952ccbfafec301c21d40e4caaa84209df9fd","unresolved":false,"context_lines":[{"line_number":42,"context_line":""},{"line_number":43,"context_line":"        self._conn \u003d self.driver.connection"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"    def list(self, marker\u003dNone, limit\u003d10, detailed\u003dFalse):"},{"line_number":46,"context_line":"        marker \u003d marker or \u0027\u0027"},{"line_number":47,"context_line":"        stmt \u003d sa.sql.select([tables.Shards]).where("},{"line_number":48,"context_line":"            tables.Shards.c.name \u003e marker"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAUX%2F%2B2Ps%3D","line":45,"in_reply_to":"AAAAUX%2F%2B9tg%3D","updated":"2014-02-18 16:58:06.000000000","message":"+1 - coming soon.","commit_id":"c0dbe7038e0e0519ec8df6ed5dbc25ee951d53b4"},{"author":{"_account_id":6427,"name":"Kurt Griffiths","email":"kurt.griffiths@rackspace.com","username":"kgriffs"},"change_message_id":"fd86be3b65f2af676ae13fcf683f578c73a4eb31","unresolved":false,"context_lines":[{"line_number":47,"context_line":"        stmt \u003d sa.sql.select([tables.Shards]).where("},{"line_number":48,"context_line":"            tables.Shards.c.name \u003e marker"},{"line_number":49,"context_line":"        ).limit(limit)"},{"line_number":50,"context_line":"        cursor \u003d self._conn.execute(stmt)"},{"line_number":51,"context_line":"        normalizer \u003d functools.partial(_normalize, detailed\u003ddetailed)"},{"line_number":52,"context_line":"        return (normalizer(v) for v in cursor)"},{"line_number":53,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAUX%2F%2B9tw%3D","line":50,"updated":"2014-02-17 23:54:04.000000000","message":"What happens if this raises an error (also the other unprotected executes called from within the other methods below)? Do we need to normalize SQLAlchemy errors to Marconi errors, similar to what the Mongo driver does via @utils.raises_conn_error ?","commit_id":"c0dbe7038e0e0519ec8df6ed5dbc25ee951d53b4"},{"author":{"_account_id":6944,"name":"Allele Dev","email":"cpp.cabrera@gmail.com","username":"cpp-cabrera"},"change_message_id":"aa29952ccbfafec301c21d40e4caaa84209df9fd","unresolved":false,"context_lines":[{"line_number":47,"context_line":"        stmt \u003d sa.sql.select([tables.Shards]).where("},{"line_number":48,"context_line":"            tables.Shards.c.name \u003e marker"},{"line_number":49,"context_line":"        ).limit(limit)"},{"line_number":50,"context_line":"        cursor \u003d self._conn.execute(stmt)"},{"line_number":51,"context_line":"        normalizer \u003d functools.partial(_normalize, detailed\u003ddetailed)"},{"line_number":52,"context_line":"        return (normalizer(v) for v in cursor)"},{"line_number":53,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAUX%2F%2B2PI%3D","line":50,"in_reply_to":"AAAAUX%2F%2B9tw%3D","updated":"2014-02-18 16:58:06.000000000","message":"Good point. I\u0027ll investigate what errors sqlalchemy might throw and work towards handling them uniformly.\n\nhandle :: SqlalchemyError -\u003e MarconiError","commit_id":"c0dbe7038e0e0519ec8df6ed5dbc25ee951d53b4"},{"author":{"_account_id":6427,"name":"Kurt Griffiths","email":"kurt.griffiths@rackspace.com","username":"kgriffs"},"change_message_id":"fd86be3b65f2af676ae13fcf683f578c73a4eb31","unresolved":false,"context_lines":[{"line_number":51,"context_line":"        normalizer \u003d functools.partial(_normalize, detailed\u003ddetailed)"},{"line_number":52,"context_line":"        return (normalizer(v) for v in cursor)"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":"    def get(self, name, detailed\u003dFalse):"},{"line_number":55,"context_line":"        stmt \u003d sa.sql.select([tables.Shards]).where("},{"line_number":56,"context_line":"            tables.Shards.c.name \u003d\u003d name"},{"line_number":57,"context_line":"        )"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAUX%2F%2B9tQ%3D","line":54,"updated":"2014-02-17 23:54:04.000000000","message":"This method could use some strategically placed blank lines to improve readability.","commit_id":"c0dbe7038e0e0519ec8df6ed5dbc25ee951d53b4"},{"author":{"_account_id":6944,"name":"Allele Dev","email":"cpp.cabrera@gmail.com","username":"cpp-cabrera"},"change_message_id":"aa29952ccbfafec301c21d40e4caaa84209df9fd","unresolved":false,"context_lines":[{"line_number":51,"context_line":"        normalizer \u003d functools.partial(_normalize, detailed\u003ddetailed)"},{"line_number":52,"context_line":"        return (normalizer(v) for v in cursor)"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":"    def get(self, name, detailed\u003dFalse):"},{"line_number":55,"context_line":"        stmt \u003d sa.sql.select([tables.Shards]).where("},{"line_number":56,"context_line":"            tables.Shards.c.name \u003d\u003d name"},{"line_number":57,"context_line":"        )"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAUX%2F%2B2PA%3D","line":54,"in_reply_to":"AAAAUX%2F%2B9tQ%3D","updated":"2014-02-18 16:58:06.000000000","message":"+1 - coming soon","commit_id":"c0dbe7038e0e0519ec8df6ed5dbc25ee951d53b4"},{"author":{"_account_id":6427,"name":"Kurt Griffiths","email":"kurt.griffiths@rackspace.com","username":"kgriffs"},"change_message_id":"fd86be3b65f2af676ae13fcf683f578c73a4eb31","unresolved":false,"context_lines":[{"line_number":60,"context_line":"            raise errors.ShardDoesNotExist(name)"},{"line_number":61,"context_line":"        return _normalize(shard, detailed)"},{"line_number":62,"context_line":""},{"line_number":63,"context_line":"    def create(self, name, weight, uri, options\u003dNone):"},{"line_number":64,"context_line":"        opts \u003d json.dumps(options) if options is not None else None"},{"line_number":65,"context_line":"        try:"},{"line_number":66,"context_line":"            stmt \u003d sa.sql.expression.insert(tables.Shards).values("}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAUX%2F%2B9uw%3D","line":63,"updated":"2014-02-17 23:54:04.000000000","message":"Should this be renamed to \"upsert\" to make it more clear what is happening? This would mean changing it in base.ShardsBase and the mongo driver as well, of course.","commit_id":"c0dbe7038e0e0519ec8df6ed5dbc25ee951d53b4"},{"author":{"_account_id":6944,"name":"Allele Dev","email":"cpp.cabrera@gmail.com","username":"cpp-cabrera"},"change_message_id":"aa29952ccbfafec301c21d40e4caaa84209df9fd","unresolved":false,"context_lines":[{"line_number":60,"context_line":"            raise errors.ShardDoesNotExist(name)"},{"line_number":61,"context_line":"        return _normalize(shard, detailed)"},{"line_number":62,"context_line":""},{"line_number":63,"context_line":"    def create(self, name, weight, uri, options\u003dNone):"},{"line_number":64,"context_line":"        opts \u003d json.dumps(options) if options is not None else None"},{"line_number":65,"context_line":"        try:"},{"line_number":66,"context_line":"            stmt \u003d sa.sql.expression.insert(tables.Shards).values("}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAUX%2F%2B2Oc%3D","line":63,"in_reply_to":"AAAAUX%2F%2B9uw%3D","updated":"2014-02-18 16:58:06.000000000","message":"Good point. I\u0027d like to hold off on this renaming for another patch, since it would touch multiple modules.","commit_id":"c0dbe7038e0e0519ec8df6ed5dbc25ee951d53b4"},{"author":{"_account_id":6427,"name":"Kurt Griffiths","email":"kurt.griffiths@rackspace.com","username":"kgriffs"},"change_message_id":"fd86be3b65f2af676ae13fcf683f578c73a4eb31","unresolved":false,"context_lines":[{"line_number":61,"context_line":"        return _normalize(shard, detailed)"},{"line_number":62,"context_line":""},{"line_number":63,"context_line":"    def create(self, name, weight, uri, options\u003dNone):"},{"line_number":64,"context_line":"        opts \u003d json.dumps(options) if options is not None else None"},{"line_number":65,"context_line":"        try:"},{"line_number":66,"context_line":"            stmt \u003d sa.sql.expression.insert(tables.Shards).values("},{"line_number":67,"context_line":"                name\u003dname, weight\u003dweight, uri\u003duri, options\u003dopts"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAUX%2F%2B9xY%3D","line":64,"updated":"2014-02-17 23:54:04.000000000","message":"Not a big deal, but inverting the conditionals seems to read a little better:\n\nopts \u003d None if options is None else json.dumps(options)\n\nAlso, \u0027opts\u0027 is really similar to \u0027options\u0027. To enhance readability, how about renaming to something like \"opts_json\" or \"options_json\" ?","commit_id":"c0dbe7038e0e0519ec8df6ed5dbc25ee951d53b4"},{"author":{"_account_id":6944,"name":"Allele Dev","email":"cpp.cabrera@gmail.com","username":"cpp-cabrera"},"change_message_id":"aa29952ccbfafec301c21d40e4caaa84209df9fd","unresolved":false,"context_lines":[{"line_number":61,"context_line":"        return _normalize(shard, detailed)"},{"line_number":62,"context_line":""},{"line_number":63,"context_line":"    def create(self, name, weight, uri, options\u003dNone):"},{"line_number":64,"context_line":"        opts \u003d json.dumps(options) if options is not None else None"},{"line_number":65,"context_line":"        try:"},{"line_number":66,"context_line":"            stmt \u003d sa.sql.expression.insert(tables.Shards).values("},{"line_number":67,"context_line":"                name\u003dname, weight\u003dweight, uri\u003duri, options\u003dopts"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAUX%2F%2B2OI%3D","line":64,"in_reply_to":"AAAAUX%2F%2B9xY%3D","updated":"2014-02-18 16:58:06.000000000","message":"+1 - coming soon.","commit_id":"c0dbe7038e0e0519ec8df6ed5dbc25ee951d53b4"},{"author":{"_account_id":6427,"name":"Kurt Griffiths","email":"kurt.griffiths@rackspace.com","username":"kgriffs"},"change_message_id":"fd86be3b65f2af676ae13fcf683f578c73a4eb31","unresolved":false,"context_lines":[{"line_number":74,"context_line":"            )"},{"line_number":75,"context_line":"            self._conn.execute(stmt)"},{"line_number":76,"context_line":""},{"line_number":77,"context_line":"    def exists(self, name):"},{"line_number":78,"context_line":"        stmt \u003d sa.sql.select([tables.Shards]).where("},{"line_number":79,"context_line":"            tables.Shards.c.name \u003d\u003d name"},{"line_number":80,"context_line":"        )"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAUX%2F%2B9so%3D","line":77,"updated":"2014-02-17 23:54:04.000000000","message":"If this function will be called often, you can make it more performant doing a \u0027limit 1\u0027, as well as constraining the fields returned to just the primary key.","commit_id":"c0dbe7038e0e0519ec8df6ed5dbc25ee951d53b4"},{"author":{"_account_id":6944,"name":"Allele Dev","email":"cpp.cabrera@gmail.com","username":"cpp-cabrera"},"change_message_id":"aa29952ccbfafec301c21d40e4caaa84209df9fd","unresolved":false,"context_lines":[{"line_number":74,"context_line":"            )"},{"line_number":75,"context_line":"            self._conn.execute(stmt)"},{"line_number":76,"context_line":""},{"line_number":77,"context_line":"    def exists(self, name):"},{"line_number":78,"context_line":"        stmt \u003d sa.sql.select([tables.Shards]).where("},{"line_number":79,"context_line":"            tables.Shards.c.name \u003d\u003d name"},{"line_number":80,"context_line":"        )"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAUX%2F%2B2L4%3D","line":77,"in_reply_to":"AAAAUX%2F%2B9so%3D","updated":"2014-02-18 16:58:06.000000000","message":"+1 - I can take care of this in this patch.","commit_id":"c0dbe7038e0e0519ec8df6ed5dbc25ee951d53b4"},{"author":{"_account_id":6427,"name":"Kurt Griffiths","email":"kurt.griffiths@rackspace.com","username":"kgriffs"},"change_message_id":"fd86be3b65f2af676ae13fcf683f578c73a4eb31","unresolved":false,"context_lines":[{"line_number":83,"context_line":"    def update(self, name, **kwargs):"},{"line_number":84,"context_line":"        # NOTE(cpp-cabrera): this adds a query to the pipeline, but it is"},{"line_number":85,"context_line":"        # currently necessary to preserve storage model semantics"},{"line_number":86,"context_line":"        if not self.exists(name):"},{"line_number":87,"context_line":"            raise errors.ShardDoesNotExist(name)"},{"line_number":88,"context_line":""},{"line_number":89,"context_line":"        # NOTE(cpp-cabrera): by pruning None-valued kwargs, we avoid"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAUX%2F%2B9qc%3D","line":86,"updated":"2014-02-17 23:54:04.000000000","message":"Is it really necessary? Can you use the \u0027rowcount\u0027 attribute of the execution result to check whether the shard existed and was updated?","commit_id":"c0dbe7038e0e0519ec8df6ed5dbc25ee951d53b4"},{"author":{"_account_id":6944,"name":"Allele Dev","email":"cpp.cabrera@gmail.com","username":"cpp-cabrera"},"change_message_id":"aa29952ccbfafec301c21d40e4caaa84209df9fd","unresolved":false,"context_lines":[{"line_number":83,"context_line":"    def update(self, name, **kwargs):"},{"line_number":84,"context_line":"        # NOTE(cpp-cabrera): this adds a query to the pipeline, but it is"},{"line_number":85,"context_line":"        # currently necessary to preserve storage model semantics"},{"line_number":86,"context_line":"        if not self.exists(name):"},{"line_number":87,"context_line":"            raise errors.ShardDoesNotExist(name)"},{"line_number":88,"context_line":""},{"line_number":89,"context_line":"        # NOTE(cpp-cabrera): by pruning None-valued kwargs, we avoid"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAUX%2F%2B2Ls%3D","line":86,"in_reply_to":"AAAAUX%2F%2B9qc%3D","updated":"2014-02-18 16:58:06.000000000","message":"Good point - I didn\u0027t realize there was a rowcount attribute. I\u0027ll fix this up.","commit_id":"c0dbe7038e0e0519ec8df6ed5dbc25ee951d53b4"},{"author":{"_account_id":6427,"name":"Kurt Griffiths","email":"kurt.griffiths@rackspace.com","username":"kgriffs"},"change_message_id":"fd86be3b65f2af676ae13fcf683f578c73a4eb31","unresolved":false,"context_lines":[{"line_number":96,"context_line":"        assert fields, \u0027`weight`, `uri`, or `options` not found in kwargs\u0027"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":"        if \u0027options\u0027 in fields:"},{"line_number":99,"context_line":"            fields[\u0027options\u0027] \u003d json.dumps(fields[\u0027options\u0027])"},{"line_number":100,"context_line":""},{"line_number":101,"context_line":"        stmt \u003d sa.sql.update(tables.Shards).where("},{"line_number":102,"context_line":"            tables.Shards.c.name \u003d\u003d name).values(**fields)"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAUX%2F%2B9sA%3D","line":99,"updated":"2014-02-17 23:54:04.000000000","message":"Is it safe to assume the options will always be simple ASCII text?","commit_id":"c0dbe7038e0e0519ec8df6ed5dbc25ee951d53b4"},{"author":{"_account_id":6944,"name":"Allele Dev","email":"cpp.cabrera@gmail.com","username":"cpp-cabrera"},"change_message_id":"aa29952ccbfafec301c21d40e4caaa84209df9fd","unresolved":false,"context_lines":[{"line_number":96,"context_line":"        assert fields, \u0027`weight`, `uri`, or `options` not found in kwargs\u0027"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":"        if \u0027options\u0027 in fields:"},{"line_number":99,"context_line":"            fields[\u0027options\u0027] \u003d json.dumps(fields[\u0027options\u0027])"},{"line_number":100,"context_line":""},{"line_number":101,"context_line":"        stmt \u003d sa.sql.update(tables.Shards).where("},{"line_number":102,"context_line":"            tables.Shards.c.name \u003d\u003d name).values(**fields)"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAUX%2F%2B2Eg%3D","line":99,"in_reply_to":"AAAAUX%2F%2B9sA%3D","updated":"2014-02-18 16:58:06.000000000","message":"Yes.\n\nIf the options text are in the ASCII set, then they are saved correctly.\n\nIf they are not in the ASCII set, json.dumps yields an unreadble string that is still persisted correctly. By correctly, I mean that there\u0027s a one-to-one mapping from the json.dump\u0027d text and what\u0027s read out in the future.\n\nafaik, it\u0027s unheard of at the moment to provide non-ascii configuration options for storage drivers.","commit_id":"c0dbe7038e0e0519ec8df6ed5dbc25ee951d53b4"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"dd4d7f4099daf532e27280048e1d65a5aa6b313d","unresolved":false,"context_lines":[{"line_number":81,"context_line":"            )"},{"line_number":82,"context_line":"            self._conn.execute(stmt)"},{"line_number":83,"context_line":""},{"line_number":84,"context_line":"        except sa.exceptions.IntegrityError:"},{"line_number":85,"context_line":"            # TODO(cpp-cabrera): merge update/create into a single"},{"line_number":86,"context_line":"            # method with introduction of upsert"},{"line_number":87,"context_line":"            self.update(name, weight\u003dweight, uri\u003duri,"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAAUX%2F%2Ba7Q%3D","line":84,"updated":"2014-02-21 08:57:02.000000000","message":"it\u0027s `sa.exc.IntegrityError`","commit_id":"038cdd46be549d2c56311026970430d4221e4ae0"},{"author":{"_account_id":6944,"name":"Allele Dev","email":"cpp.cabrera@gmail.com","username":"cpp-cabrera"},"change_message_id":"6d501636fe509f73ef2a1a3a6764cceaa91f25c8","unresolved":false,"context_lines":[{"line_number":81,"context_line":"            )"},{"line_number":82,"context_line":"            self._conn.execute(stmt)"},{"line_number":83,"context_line":""},{"line_number":84,"context_line":"        except sa.exceptions.IntegrityError:"},{"line_number":85,"context_line":"            # TODO(cpp-cabrera): merge update/create into a single"},{"line_number":86,"context_line":"            # method with introduction of upsert"},{"line_number":87,"context_line":"            self.update(name, weight\u003dweight, uri\u003duri,"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAAUX%2F%2BZKE%3D","line":84,"in_reply_to":"AAAAUX%2F%2Ba7Q%3D","updated":"2014-02-21 13:01:38.000000000","message":"Curiously, both are defined. However, on a casual reading of the SA source, it\u0027s not immediately obvious how. I\u0027ll use the \u0027exc\u0027 variant.\n\nNice catch. :)","commit_id":"038cdd46be549d2c56311026970430d4221e4ae0"}],"marconi/queues/storage/sqlalchemy/tables.py":[{"author":{"_account_id":6427,"name":"Kurt Griffiths","email":"kurt.griffiths@rackspace.com","username":"kgriffs"},"change_message_id":"fd86be3b65f2af676ae13fcf683f578c73a4eb31","unresolved":false,"context_lines":[{"line_number":111,"context_line":"                  sa.Column(\u0027name\u0027, sa.String, primary_key\u003dTrue),"},{"line_number":112,"context_line":"                  sa.Column(\u0027uri\u0027, sa.String, nullable\u003dFalse),"},{"line_number":113,"context_line":"                  sa.Column(\u0027weight\u0027, sa.INTEGER, nullable\u003dFalse),"},{"line_number":114,"context_line":"                  sa.Column(\u0027options\u0027, sa.BINARY))"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAUX%2F%2B9pY%3D","line":114,"updated":"2014-02-17 23:54:04.000000000","message":"Won\u0027t options always be text, since we are dumping dict\u0027s to a string via json.dumps? What does sa.BINARY buy us?","commit_id":"c0dbe7038e0e0519ec8df6ed5dbc25ee951d53b4"},{"author":{"_account_id":6944,"name":"Allele Dev","email":"cpp.cabrera@gmail.com","username":"cpp-cabrera"},"change_message_id":"aa29952ccbfafec301c21d40e4caaa84209df9fd","unresolved":false,"context_lines":[{"line_number":111,"context_line":"                  sa.Column(\u0027name\u0027, sa.String, primary_key\u003dTrue),"},{"line_number":112,"context_line":"                  sa.Column(\u0027uri\u0027, sa.String, nullable\u003dFalse),"},{"line_number":113,"context_line":"                  sa.Column(\u0027weight\u0027, sa.INTEGER, nullable\u003dFalse),"},{"line_number":114,"context_line":"                  sa.Column(\u0027options\u0027, sa.BINARY))"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAUX%2F%2B2Dk%3D","line":114,"in_reply_to":"AAAAUX%2F%2B9pY%3D","updated":"2014-02-18 16:58:06.000000000","message":"Good question.\n\nAt best, it buys us a tiny optimization: http://www.sqlite.org/datatype3.html\n\n* BLOB: stored as is\n* TEXT: stored with database encoding","commit_id":"c0dbe7038e0e0519ec8df6ed5dbc25ee951d53b4"}],"tests/etc/wsgi_sqlalchemy.conf":[{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"647d24ee4d67d5390ed153e62d4e48a7d4713c59","unresolved":false,"context_lines":[{"line_number":10,"context_line":"port \u003d 8888"},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"[drivers:storage:sqlalchemy]"},{"line_number":13,"context_line":"dialect \u003d sqlite"},{"line_number":14,"context_line":"driver \u003d pysqlite"},{"line_number":15,"context_line":"database \u003d :memory:"}],"source_content_type":"text/plain","patch_set":4,"id":"AAAAUX%2F%2FZvA%3D","line":13,"updated":"2014-02-13 13:29:31.000000000","message":"dialect?","commit_id":"434be947d768c5182ef3701d1e5d2b1604663333"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"647d24ee4d67d5390ed153e62d4e48a7d4713c59","unresolved":false,"context_lines":[{"line_number":11,"context_line":""},{"line_number":12,"context_line":"[drivers:storage:sqlalchemy]"},{"line_number":13,"context_line":"dialect \u003d sqlite"},{"line_number":14,"context_line":"driver \u003d pysqlite"},{"line_number":15,"context_line":"database \u003d :memory:"}],"source_content_type":"text/plain","patch_set":4,"id":"AAAAUX%2F%2FZvI%3D","line":14,"updated":"2014-02-13 13:29:31.000000000","message":"pysqlite ?","commit_id":"434be947d768c5182ef3701d1e5d2b1604663333"},{"author":{"_account_id":6944,"name":"Allele Dev","email":"cpp.cabrera@gmail.com","username":"cpp-cabrera"},"change_message_id":"bf067d2c910dcf3fb4d8fba3c0cbb8fd42ba8cba","unresolved":false,"context_lines":[{"line_number":12,"context_line":"[drivers:storage:sqlalchemy]"},{"line_number":13,"context_line":"dialect \u003d sqlite"},{"line_number":14,"context_line":"driver \u003d pysqlite"},{"line_number":15,"context_line":"database \u003d :memory:"}],"source_content_type":"text/plain","patch_set":4,"id":"AAAAUX%2F%2B04A%3D","line":15,"updated":"2014-02-18 19:18:48.000000000","message":"Nice catch! Fixed in the latest.","commit_id":"434be947d768c5182ef3701d1e5d2b1604663333"}]}
