)]}'
{"id":"openstack%2Foslo.db~792567","triplet_id":"openstack%2Foslo.db~master~I0d1a197e7e62062a87b8d5c77b499ea633f4f88d","project":"openstack/oslo.db","branch":"master","topic":"bug/1920923","hashtags":[],"change_id":"I0d1a197e7e62062a87b8d5c77b499ea633f4f88d","subject":"Add method to return the SQL dialect specific rand method","status":"ABANDONED","created":"2021-05-21 10:09:41.000000000","updated":"2021-05-21 16:16:57.000000000","total_comment_count":0,"unresolved_comment_count":0,"has_review_started":true,"meta_rev_id":"f18c1e9a78c7286351c7781ea4ccb23f3b30d33b","_number":792567,"virtual_id_number":792567,"owner":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"actions":{},"labels":{"Verified":{"recommended":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"all":[{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},{"tag":"autogenerated:zuul:check","value":1,"date":"2021-05-21 11:33:21.000000000","permitted_voting_range":{"min":-2,"max":2},"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]}],"values":{"-2":"Fails","-1":"Doesn\u0027t seem to work"," 0":"No score","+1":"Works for me","+2":"Verified"},"description":"","value":1,"default_value":0,"optional":true},"Code-Review":{"all":[{"value":0,"permitted_voting_range":{"min":-1,"max":1},"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},{"value":0,"permitted_voting_range":{"min":-2,"max":2},"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},{"value":0,"permitted_voting_range":{"min":-1,"max":1},"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]}],"values":{"-2":"Do not merge","-1":"This patch needs further work before it can be merged"," 0":"No score","+1":"Looks good to me, but someone else must approve","+2":"Looks good to me (core reviewer)"},"description":"","default_value":0,"optional":true},"Workflow":{"rejected":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"all":[{"value":-1,"date":"2021-05-21 14:22:29.000000000","permitted_voting_range":{"min":-1,"max":0},"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},{"value":0,"permitted_voting_range":{"min":-1,"max":1},"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]}],"values":{"-1":"Work in progress"," 0":"Ready for reviews","+1":"Approved"},"description":"","default_value":0,"optional":true},"Backport-Candidate":{"disliked":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"all":[{"value":0,"permitted_voting_range":{"min":-1,"max":1},"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},{"value":-1,"date":"2021-05-21 12:53:20.000000000","permitted_voting_range":{"min":-2,"max":2},"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},{"value":0,"permitted_voting_range":{"min":-1,"max":1},"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]}],"values":{"-2":"Do Not Backport","-1":"Not A Backport Candidate"," 0":"Backport Review Needed","+1":"Proposed Backport","+2":"Should Backport"},"description":"","value":-1,"default_value":0,"optional":true}},"removable_reviewers":[],"reviewers":{"REVIEWER":[{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]}]},"pending_reviewers":{},"reviewer_updates":[{"updated":"2021-05-21 11:33:21.000000000","updated_by":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"reviewer":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"state":"REVIEWER"},{"updated":"2021-05-21 12:53:20.000000000","updated_by":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"reviewer":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"state":"REVIEWER"}],"messages":[{"id":"6f1ea1513a8dfd68e30bf522f52fd29000e20805","tag":"autogenerated:gerrit:newPatchSet","author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"date":"2021-05-21 10:09:41.000000000","message":"Uploaded patch set 1.","accounts_in_message":[],"_revision_number":1},{"id":"e53623a0786125f358729f4e369a742f7eae7d80","tag":"autogenerated:zuul:check","author":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"date":"2021-05-21 11:33:21.000000000","message":"Patch Set 1: Verified+1\n\nBuild succeeded (check pipeline).\n\n- tempest-full-py3 https://zuul.opendev.org/t/openstack/build/10938f1c505749e78e69e46df80e99bb : SUCCESS in 1h 16m 34s\n- openstack-tox-pep8 https://zuul.opendev.org/t/openstack/build/fb3b5c45550249fb82dfd462cf01b78b : SUCCESS in 5m 12s\n- openstack-tox-py36 https://zuul.opendev.org/t/openstack/build/33097bc5ecda4e238cc1294438bc3ae2 : SUCCESS in 5m 43s\n- openstack-tox-py38 https://zuul.opendev.org/t/openstack/build/4df8c157ef284149987f7dd55f13cca0 : SUCCESS in 7m 24s\n- openstack-tox-py39 https://zuul.opendev.org/t/openstack/build/ddb6439e0c08497294aa9b3890b1a9f5 : SUCCESS in 7m 39s (non-voting)\n- openstack-tox-docs https://zuul.opendev.org/t/openstack/build/2d32aed8a89f4f799615f30445cff289 : SUCCESS in 5m 50s","accounts_in_message":[],"_revision_number":1},{"id":"0cc357ad34615e33da4ef9809d34bc319a56762e","author":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"date":"2021-05-21 12:53:20.000000000","message":"Patch Set 1: Backport-Candidate-1\n\nhey there! \n\na new feature, this is great.   however, I would prefer if you use the SQLAlchemy API that is dedicated to this kind of use case which is the compiles extension, such as in this example:\n\nhttps://docs.sqlalchemy.org/en/14/core/compiler.html#greatest-function\n\n\nA freestanding \"random()\" can therefore be produced as in the following example:\n\n\n    from sqlalchemy import select\n    from sqlalchemy.dialects import mysql\n    from sqlalchemy.dialects import postgresql\n    from sqlalchemy.ext.compiler import compiles\n    from sqlalchemy.sql import expression\n    from sqlalchemy.types import Numeric\n\n    class random(expression.FunctionElement):\n        type \u003d Numeric()\n        name \u003d \u0027random\u0027\n\n    @compiles(random)\n    def default_random(element, compiler, **kw):\n        return \"random()\"\n\n    @compiles(random, \u0027mysql\u0027)\n    def mysql_random(element, compiler, **kw):\n        return \"rand()\"\n\n\n    stmt \u003d select([random()])\n\n    print(stmt.compile(dialect\u003dpostgresql.dialect()))\n    print(stmt.compile(dialect\u003dmysql.dialect()))\n\n\n\nas a bonus, we may also have this \"random()\" be registered to occur automatically from the func namespace using GenericFunction:  https://docs.sqlalchemy.org/en/14/core/functions.html?highlight\u003dgenericfunction#sqlalchemy.sql.functions.GenericFunction\n\ndemo modified to use genericfunction:\n\n    from sqlalchemy import select\n    from sqlalchemy.dialects import mysql\n    from sqlalchemy.dialects import postgresql\n    from sqlalchemy.ext.compiler import compiles\n    from sqlalchemy.sql import functions\n    from sqlalchemy.types import Numeric\n    from sqlalchemy import func\n\n    class random(functions.GenericFunction):\n        type \u003d Numeric()\n        name \u003d \u0027random\u0027\n        package \u003d \"oslo_db\"\n\n    @compiles(random)\n    def default_random(element, compiler, **kw):\n        return \"random()\"\n\n    @compiles(random, \u0027mysql\u0027)\n    def mysql_random(element, compiler, **kw):\n        return \"rand()\"\n\n\n    # note we can call func.oslo_db.random() here\n    stmt \u003d select([func.oslo_db.random()])\n\n    print(stmt.compile(dialect\u003dpostgresql.dialect()))\n    print(stmt.compile(dialect\u003dmysql.dialect()))\n\n\n    # the other way works too\n    stmt \u003d select([random()])\n\n    print(stmt.compile(dialect\u003dpostgresql.dialect()))\n    print(stmt.compile(dialect\u003dmysql.dialect()))","accounts_in_message":[],"_revision_number":1},{"id":"cfbe71505dd2bf594aae9af658ecd52373ef4f41","author":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"date":"2021-05-21 12:53:43.000000000","message":"Patch Set 1:\n\nthis also needs tests","accounts_in_message":[],"_revision_number":1},{"id":"38506e1582aa128d560bdc0fbac1a5cde1bdda22","author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"date":"2021-05-21 13:55:32.000000000","message":"Patch Set 1:\n\nThat was the most instructive review I\u0027ve ever had. Is like you are related with zzzeek... hehehe\n\nThanks!","accounts_in_message":[],"_revision_number":1},{"id":"a3f9e89a14524822830ef6c718b19f8c6b913700","author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"date":"2021-05-21 14:22:29.000000000","message":"Patch Set 1: Workflow-1\n\n\u003e Patch Set 1:\n\u003e \n\u003e That was the most instructive review I\u0027ve ever had. Is like you are related with zzzeek... hehehe\n\u003e \n\u003e Thanks!\n\nBTW, I\u0027ve investigated a bit in sqlalchemy code and I found [1]. I think we already have this in sql.functions.random(). Is that correct?\n\n[1]https://github.com/sqlalchemy/sqlalchemy/blame/master/doc/build/changelog/changelog_04.rst#L741-L742","accounts_in_message":[],"_revision_number":1},{"id":"d1323609f7b4c6531316aa3af8ba91383b165f57","author":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"date":"2021-05-21 15:00:26.000000000","message":"Patch Set 1:\n\n\u003e Patch Set 1: Workflow-1\n\u003e \n\u003e \u003e Patch Set 1:\n\u003e \u003e \n\u003e \u003e That was the most instructive review I\u0027ve ever had. Is like you are related with zzzeek... hehehe\n\u003e \u003e \n\u003e \u003e Thanks!\n\u003e \n\u003e BTW, I\u0027ve investigated a bit in sqlalchemy code and I found [1]. I think we already have this in sql.functions.random(). Is that correct?\n\u003e \n\u003e [1]https://github.com/sqlalchemy/sqlalchemy/blame/master/doc/build/changelog/changelog_04.rst#L741-L742\n\nyes looks like it, if you just do func.random() it should do waht you want as I see mysql dialect is intercepting it here: https://github.com/sqlalchemy/sqlalchemy/blob/master/lib/sqlalchemy/dialects/mysql/base.py#L1426","accounts_in_message":[],"_revision_number":1},{"id":"a6c07278efa6ec6c1e3de9cc5050f8be4d2f4106","author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"date":"2021-05-21 16:16:50.000000000","message":"Patch Set 1:\n\n\u003e Patch Set 1:\n\u003e \n\u003e \u003e Patch Set 1: Workflow-1\n\u003e \u003e \n\u003e \u003e \u003e Patch Set 1:\n\u003e \u003e \u003e \n\u003e \u003e \u003e That was the most instructive review I\u0027ve ever had. Is like you are related with zzzeek... hehehe\n\u003e \u003e \u003e \n\u003e \u003e \u003e Thanks!\n\u003e \u003e \n\u003e \u003e BTW, I\u0027ve investigated a bit in sqlalchemy code and I found [1]. I think we already have this in sql.functions.random(). Is that correct?\n\u003e \u003e \n\u003e \u003e [1]https://github.com/sqlalchemy/sqlalchemy/blame/master/doc/build/changelog/changelog_04.rst#L741-L742\n\u003e \n\u003e yes looks like it, if you just do func.random() it should do waht you want as I see mysql dialect is intercepting it here: https://github.com/sqlalchemy/sqlalchemy/blob/master/lib/sqlalchemy/dialects/mysql/base.py#L1426\n\nThanks for the review. If the feature is in sqlalchemy, I\u0027ll abandon this patch.","accounts_in_message":[],"_revision_number":1},{"id":"f18c1e9a78c7286351c7781ea4ccb23f3b30d33b","tag":"autogenerated:gerrit:abandon","author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"date":"2021-05-21 16:16:57.000000000","message":"Abandoned","accounts_in_message":[],"_revision_number":1}],"current_revision_number":1,"current_revision":"262ae0829b502bd746ed6c970c232fb69a66b4a9","revisions":{"262ae0829b502bd746ed6c970c232fb69a66b4a9":{"kind":"REWORK","_number":1,"created":"2021-05-21 10:09:41.000000000","uploader":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"ref":"refs/changes/67/792567/1","fetch":{"anonymous http":{"url":"https://review.opendev.org/openstack/oslo.db","ref":"refs/changes/67/792567/1","commands":{"Checkout":"git fetch https://review.opendev.org/openstack/oslo.db refs/changes/67/792567/1 \u0026\u0026 git checkout FETCH_HEAD","Cherry Pick":"git fetch https://review.opendev.org/openstack/oslo.db refs/changes/67/792567/1 \u0026\u0026 git cherry-pick FETCH_HEAD","Format Patch":"git fetch https://review.opendev.org/openstack/oslo.db refs/changes/67/792567/1 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD","Pull":"git pull https://review.opendev.org/openstack/oslo.db refs/changes/67/792567/1"}}},"commit":{"parents":[{"commit":"3400d2df482c01ba1ea0686c8922ccca73fcdd57","subject":"Merge \"setup.cfg: Replace dashes with underscores\"","web_links":[{"name":"gitea","tooltip":"Open in GitWeb","url":"https://opendev.org/openstack/oslo.db/commit/3400d2df482c01ba1ea0686c8922ccca73fcdd57"}]}],"author":{"name":"Rodolfo Alonso Hernandez","email":"ralonsoh@redhat.com","date":"2021-05-21 10:07:02.000000000","tz":0},"committer":{"name":"Rodolfo Alonso Hernandez","email":"ralonsoh@redhat.com","date":"2021-05-21 10:09:39.000000000","tz":0},"subject":"Add method to return the SQL dialect specific rand method","message":"Add method to return the SQL dialect specific rand method\n\nDepending on the SQL dialect (\"postgresql\", \"sqlite\", \"mysql\"),\nthe random method used is different.\n\nIn case of not matching any supported dialect, the method returns\nNone.\n\nRelated-Bug: #1920923\nChange-Id: I0d1a197e7e62062a87b8d5c77b499ea633f4f88d\n","web_links":[{"name":"gitea","tooltip":"Open in GitWeb","url":"https://opendev.org/openstack/oslo.db/commit/262ae0829b502bd746ed6c970c232fb69a66b4a9"}],"resolve_conflicts_web_links":[{"name":"gitea","tooltip":"Open in GitWeb","url":"https://opendev.org/openstack/oslo.db/commit/262ae0829b502bd746ed6c970c232fb69a66b4a9"}]},"branch":"refs/heads/master"}},"requirements":[],"submit_records":[],"submit_requirements":[]}
