)]}'
{"oslo/db/sqlalchemy/utils.py":[{"author":{"_account_id":6849,"name":"Roman Podoliaka","email":"roman.podoliaka@gmail.com","username":"rpodolyaka"},"change_message_id":"e18f9970c6363121e7f3847c29a0ad829476269f","unresolved":false,"context_lines":[{"line_number":779,"context_line":"    return column in t.c"},{"line_number":780,"context_line":""},{"line_number":781,"context_line":""},{"line_number":782,"context_line":"def drop_schema(engine):"},{"line_number":783,"context_line":"    \"\"\"\"\"\""},{"line_number":784,"context_line":"    with engine.begin() as conn:"},{"line_number":785,"context_line":"        inspector \u003d reflection.Inspector.from_engine(engine)"}],"source_content_type":"text/x-python","patch_set":1,"id":"baada198_4790ff42","line":782,"updated":"2014-07-14 08:43:25.000000000","message":"I\u0027m looking forward to see this implemented! I\u0027d be nice, if we could also drop PostgreSQL ENUM types here","commit_id":"05f8ce5a1feeeeb6039da80de4397816ed189cf7"},{"author":{"_account_id":7536,"name":"Ilya Pekelny","email":"ipekelny@mirantis.com","username":"I159"},"change_message_id":"2cf3937fd1990559d118580fed6cf4a5a9bb0258","unresolved":false,"context_lines":[{"line_number":779,"context_line":"    return column in t.c"},{"line_number":780,"context_line":""},{"line_number":781,"context_line":""},{"line_number":782,"context_line":"def drop_schema(engine):"},{"line_number":783,"context_line":"    \"\"\"\"\"\""},{"line_number":784,"context_line":"    with engine.begin() as conn:"},{"line_number":785,"context_line":"        inspector \u003d reflection.Inspector.from_engine(engine)"}],"source_content_type":"text/x-python","patch_set":1,"id":"baada198_e56941f9","line":782,"in_reply_to":"baada198_4790ff42","updated":"2014-07-18 12:36:52.000000000","message":"It is. Please, see the latest patch set test.","commit_id":"05f8ce5a1feeeeb6039da80de4397816ed189cf7"},{"author":{"_account_id":6849,"name":"Roman Podoliaka","email":"roman.podoliaka@gmail.com","username":"rpodolyaka"},"change_message_id":"bf7a5b6fc3fce82a297f0ec4e3e3c338ab3fd42e","unresolved":false,"context_lines":[{"line_number":778,"context_line":""},{"line_number":779,"context_line":""},{"line_number":780,"context_line":"def drop_schema(engine):"},{"line_number":781,"context_line":"    \"\"\"\"\"\""},{"line_number":782,"context_line":"    with engine.begin() as conn:"},{"line_number":783,"context_line":"        inspector \u003d reflection.Inspector.from_engine(engine)"},{"line_number":784,"context_line":"        metadata \u003d schema.MetaData()"}],"source_content_type":"text/x-python","patch_set":8,"id":"baada198_c8e294d4","line":781,"updated":"2014-07-18 12:55:16.000000000","message":"docstring is missing :)","commit_id":"caebc74b5ec8d4938744609a987a10e2610bf904"},{"author":{"_account_id":7536,"name":"Ilya Pekelny","email":"ipekelny@mirantis.com","username":"I159"},"change_message_id":"e83d26c6d461d8909706de9f04c5415ed779163a","unresolved":false,"context_lines":[{"line_number":778,"context_line":""},{"line_number":779,"context_line":""},{"line_number":780,"context_line":"def drop_schema(engine):"},{"line_number":781,"context_line":"    \"\"\"\"\"\""},{"line_number":782,"context_line":"    with engine.begin() as conn:"},{"line_number":783,"context_line":"        inspector \u003d reflection.Inspector.from_engine(engine)"},{"line_number":784,"context_line":"        metadata \u003d schema.MetaData()"}],"source_content_type":"text/x-python","patch_set":8,"id":"baada198_88f5fc52","line":781,"in_reply_to":"baada198_c8e294d4","updated":"2014-07-18 16:52:45.000000000","message":"oops...","commit_id":"caebc74b5ec8d4938744609a987a10e2610bf904"},{"author":{"_account_id":6849,"name":"Roman Podoliaka","email":"roman.podoliaka@gmail.com","username":"rpodolyaka"},"change_message_id":"bf7a5b6fc3fce82a297f0ec4e3e3c338ab3fd42e","unresolved":false,"context_lines":[{"line_number":801,"context_line":"            conn.execute(schema.DropConstraint(fkc))"},{"line_number":802,"context_line":""},{"line_number":803,"context_line":"        for table in tbs:"},{"line_number":804,"context_line":"            conn.execute(schema.DropTable(table))"}],"source_content_type":"text/x-python","patch_set":8,"id":"baada198_88eb3ca3","line":804,"updated":"2014-07-18 12:55:16.000000000","message":"ENUM types in PostgreSQL won\u0027t be dropped here. Could you please do a research on how hard it\u0027d would be to do that in this function?","commit_id":"caebc74b5ec8d4938744609a987a10e2610bf904"},{"author":{"_account_id":7536,"name":"Ilya Pekelny","email":"ipekelny@mirantis.com","username":"I159"},"change_message_id":"e83d26c6d461d8909706de9f04c5415ed779163a","unresolved":false,"context_lines":[{"line_number":801,"context_line":"            conn.execute(schema.DropConstraint(fkc))"},{"line_number":802,"context_line":""},{"line_number":803,"context_line":"        for table in tbs:"},{"line_number":804,"context_line":"            conn.execute(schema.DropTable(table))"}],"source_content_type":"text/x-python","patch_set":8,"id":"baada198_83ff9633","line":804,"in_reply_to":"baada198_88eb3ca3","updated":"2014-07-18 16:52:45.000000000","message":"Done","commit_id":"caebc74b5ec8d4938744609a987a10e2610bf904"},{"author":{"_account_id":6849,"name":"Roman Podoliaka","email":"roman.podoliaka@gmail.com","username":"rpodolyaka"},"change_message_id":"674bcd2d598175e344a0727a83281beae1b525eb","unresolved":false,"context_lines":[{"line_number":806,"context_line":"            tbs.append(table)"},{"line_number":807,"context_line":"            all_fks.extend(fks)"},{"line_number":808,"context_line":""},{"line_number":809,"context_line":"            for column in inspector.get_columns(table_name):"},{"line_number":810,"context_line":"                if isinstance(column[\u0027type\u0027],"},{"line_number":811,"context_line":"                    sqlalchemy.dialects.postgresql.base.ENUM):"},{"line_number":812,"context_line":"                    enums.append(column[\u0027type\u0027])"}],"source_content_type":"text/x-python","patch_set":10,"id":"baada198_ce79b5fd","line":809,"updated":"2014-07-18 17:01:59.000000000","message":"This will effectively reflect the whole schema, while the point of having this function was to be able to drop all the tables/constraints/indexes/ENUMs efficiently. Let\u0027s try to find a better way of doing that, and if that\u0027s not possible, we\u0027ll go with what we have now.","commit_id":"21181d5f57757016d9f571564373bcf45e60a449"},{"author":{"_account_id":7536,"name":"Ilya Pekelny","email":"ipekelny@mirantis.com","username":"I159"},"change_message_id":"1a69c6bdcf14d920e540e61aab76e622390a9052","unresolved":false,"context_lines":[{"line_number":806,"context_line":"            tbs.append(table)"},{"line_number":807,"context_line":"            all_fks.extend(fks)"},{"line_number":808,"context_line":""},{"line_number":809,"context_line":"            for column in inspector.get_columns(table_name):"},{"line_number":810,"context_line":"                if isinstance(column[\u0027type\u0027],"},{"line_number":811,"context_line":"                    sqlalchemy.dialects.postgresql.base.ENUM):"},{"line_number":812,"context_line":"                    enums.append(column[\u0027type\u0027])"}],"source_content_type":"text/x-python","patch_set":10,"id":"baada198_fc32760e","line":809,"in_reply_to":"baada198_50ac299f","updated":"2014-07-21 16:22:08.000000000","message":"\u003e\u003e\u003e 1. Send me a PR\n\nWhat is PR?\n\nI tried to implement it as is. I can get dict with all enums, but how to reflect and drop it?\n\nThis is definitely wrong way:\n\nfor enum in inspector.dialect._load_enums(conn):            \n    conn.execute(schema.DropSequence(schema.Sequence(enum)))\n\nBecause of:\n\nProgrammingError: (ProgrammingError) sequence \"mood\" does not exist\n \u0027DROP SEQUENCE mood\u0027 {}","commit_id":"21181d5f57757016d9f571564373bcf45e60a449"},{"author":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"change_message_id":"3aa74b8ea6773eaa55152e49d44c642fcaaa5336","unresolved":false,"context_lines":[{"line_number":806,"context_line":"            tbs.append(table)"},{"line_number":807,"context_line":"            all_fks.extend(fks)"},{"line_number":808,"context_line":""},{"line_number":809,"context_line":"            for column in inspector.get_columns(table_name):"},{"line_number":810,"context_line":"                if isinstance(column[\u0027type\u0027],"},{"line_number":811,"context_line":"                    sqlalchemy.dialects.postgresql.base.ENUM):"},{"line_number":812,"context_line":"                    enums.append(column[\u0027type\u0027])"}],"source_content_type":"text/x-python","patch_set":10,"id":"baada198_50ac299f","line":809,"in_reply_to":"baada198_62cc1136","updated":"2014-07-21 14:31:55.000000000","message":"the PG dialect has two functions for loading additional types: dialect._load_enums and dialect._load_domains.    Both of these functions can be made available in a public sense by adding them to the PGInspector interface, where you would have them avaiable here on inspector, e.g. \"if hasattr(inspector, get_enums): drop_enums(inspector.get_enums())\".   So the steps to make this available here are: 1.  Send me a PR against sqlalchemy/dialects/postgresql/base.py and corresponding tests that add these methods to PGInspector 2. on the olso.db side, we can either leave this feature as dependent on newer SQLAlchemy, *or* once we know future versions of SQLAlchemy will have these, we can check for version \u003c sa097 and if so safely use the engine.dialect._load_enums and engine.dialect._load_domains methods for those already-released versions.\n\nalso note we would need to possibly enhance the enums/domains queries to be able to filter on schema/database, right now it returns all of them for all schemas (though the schema name is present)","commit_id":"21181d5f57757016d9f571564373bcf45e60a449"},{"author":{"_account_id":7536,"name":"Ilya Pekelny","email":"ipekelny@mirantis.com","username":"I159"},"change_message_id":"27ffb111d86d7ab5b572f1dec1670fb804585b99","unresolved":false,"context_lines":[{"line_number":806,"context_line":"            tbs.append(table)"},{"line_number":807,"context_line":"            all_fks.extend(fks)"},{"line_number":808,"context_line":""},{"line_number":809,"context_line":"            for column in inspector.get_columns(table_name):"},{"line_number":810,"context_line":"                if isinstance(column[\u0027type\u0027],"},{"line_number":811,"context_line":"                    sqlalchemy.dialects.postgresql.base.ENUM):"},{"line_number":812,"context_line":"                    enums.append(column[\u0027type\u0027])"}],"source_content_type":"text/x-python","patch_set":10,"id":"baada198_62cc1136","line":809,"in_reply_to":"baada198_ce79b5fd","updated":"2014-07-21 09:15:32.000000000","message":"I haven\u0027t found a way to drop enum type with sqlalchemy, not using reflection in one form or another. Maybe Mike will correct me. Anyway we still can drop it with raw sql. How do you think, does the game worth the candles?","commit_id":"21181d5f57757016d9f571564373bcf45e60a449"},{"author":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"change_message_id":"f91aa43a9d8e1fc4c8192f1a41729b513369f0af","unresolved":false,"context_lines":[{"line_number":806,"context_line":"            tbs.append(table)"},{"line_number":807,"context_line":"            all_fks.extend(fks)"},{"line_number":808,"context_line":""},{"line_number":809,"context_line":"            for column in inspector.get_columns(table_name):"},{"line_number":810,"context_line":"                if isinstance(column[\u0027type\u0027],"},{"line_number":811,"context_line":"                    sqlalchemy.dialects.postgresql.base.ENUM):"},{"line_number":812,"context_line":"                    enums.append(column[\u0027type\u0027])"}],"source_content_type":"text/x-python","patch_set":10,"id":"baada198_05598efc","line":809,"in_reply_to":"baada198_fc32760e","updated":"2014-07-21 16:26:01.000000000","message":"PR \u003d pull request.   https://github.com/zzzeek/sqlalchemy/pulls :).\n\nthese are Enum objects.  so to drop them, easiest way is postgresql.ENUM(name\u003d\u0027myname\u0027).drop(conn).  a sequence is an entirely different construct (e.g. a SEQUENCE).","commit_id":"21181d5f57757016d9f571564373bcf45e60a449"},{"author":{"_account_id":7536,"name":"Ilya Pekelny","email":"ipekelny@mirantis.com","username":"I159"},"change_message_id":"7bcf803c7b5ac0430f8b4e82322b6db81e68e7c8","unresolved":false,"context_lines":[{"line_number":814,"context_line":""},{"line_number":815,"context_line":"        if inspector.dialect.name \u003d\u003d \u0027postgresql\u0027:"},{"line_number":816,"context_line":"            for enum in inspector.dialect._load_enums(conn):"},{"line_number":817,"context_line":"                postgresql.ENUM(name\u003denum).drop(conn)"}],"source_content_type":"text/x-python","patch_set":11,"id":"baada198_c7b3d398","line":817,"updated":"2014-07-22 15:10:52.000000000","message":"Now we have the only problem here:\n\n[Michael Bayer] \u003e\u003e\u003e it returns all of them for all schemas.","commit_id":"292c14d1cc5d624a70a7882c5f94f93ddad54694"},{"author":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"change_message_id":"6cdf9bcf910227d0cd72c80fb5e2f057eccfd23a","unresolved":false,"context_lines":[{"line_number":814,"context_line":""},{"line_number":815,"context_line":"        if inspector.dialect.name \u003d\u003d \u0027postgresql\u0027:"},{"line_number":816,"context_line":"            for enum in inspector.dialect._load_enums(conn):"},{"line_number":817,"context_line":"                postgresql.ENUM(name\u003denum).drop(conn)"}],"source_content_type":"text/x-python","patch_set":11,"id":"baada198_d4be1864","line":817,"in_reply_to":"baada198_c7b3d398","updated":"2014-07-22 16:23:34.000000000","message":"the approach for this is:\n\n1. propose enhancements upstream in SQLAlchemy.  E.g. public API access via Inspector, a \"schema\" argument.  Here\u0027s where they go: \nhttps://bitbucket.org/zzzeek/sqlalchemy/issues?status\u003dnew\u0026status\u003dopen as well as https://github.com/zzzeek/sqlalchemy/pulls\n\n2. Implement a \"backwards compat\" system in oslo.db.sqlalchemy.compat.  In this case, I\u0027d re-implement the whole _load_enums() function from the Postgresql dialect in SQLAlchemy.  See oslo.db.sqlalchemy.compat.handle_error as an example. \n\nthat way:\n\n1. we don\u0027t use private API (_load_enums()) that isn\u0027t forwards-compatible\n\n2. We get exactly the function we want, e.g. inspector.get_enums(local_schema_only)\n\n3. SQLAlchemy is improved","commit_id":"292c14d1cc5d624a70a7882c5f94f93ddad54694"},{"author":{"_account_id":7536,"name":"Ilya Pekelny","email":"ipekelny@mirantis.com","username":"I159"},"change_message_id":"a68a7b13a53d97397918d7c1573c432a8fee0c57","unresolved":false,"context_lines":[{"line_number":814,"context_line":""},{"line_number":815,"context_line":"        if inspector.dialect.name \u003d\u003d \u0027postgresql\u0027:"},{"line_number":816,"context_line":"            for enum in inspector.dialect._load_enums(conn):"},{"line_number":817,"context_line":"                postgresql.ENUM(name\u003denum).drop(conn)"}],"source_content_type":"text/x-python","patch_set":11,"id":"baada198_14fed739","line":817,"in_reply_to":"baada198_d4be1864","updated":"2014-07-29 15:47:51.000000000","message":"I have made a pull request in Sqlalchemy with the change.","commit_id":"292c14d1cc5d624a70a7882c5f94f93ddad54694"}],"tests/sqlalchemy/test_utils.py":[{"author":{"_account_id":6849,"name":"Roman Podoliaka","email":"roman.podoliaka@gmail.com","username":"rpodolyaka"},"change_message_id":"bf7a5b6fc3fce82a297f0ec4e3e3c338ab3fd42e","unresolved":false,"context_lines":[{"line_number":892,"context_line":""},{"line_number":893,"context_line":"    @db_test_base.backend_specific(\u0027mysql\u0027, \u0027postgresql\u0027)"},{"line_number":894,"context_line":"    def test_drop_schema(self):"},{"line_number":895,"context_line":"        if self.engine.name \u003d\u003d \u0027postgresql\u0027:"},{"line_number":896,"context_line":"            sql \u003d ("},{"line_number":897,"context_line":"                \"CREATE TYPE mood AS ENUM (\u0027sad\u0027, \u0027ok\u0027, \u0027happy\u0027);\","},{"line_number":898,"context_line":"                \u0027CREATE TABLE ct1 (a INT NOT NULL, mood mood, \u0027"}],"source_content_type":"text/x-python","patch_set":8,"id":"baada198_a88f2022","line":895,"updated":"2014-07-18 12:55:16.000000000","message":"not a big deal, but why not to define this schema in terms of SQLAlchemy MetaData? IMO, that would allow us to make this code common for all supported backends","commit_id":"caebc74b5ec8d4938744609a987a10e2610bf904"},{"author":{"_account_id":7536,"name":"Ilya Pekelny","email":"ipekelny@mirantis.com","username":"I159"},"change_message_id":"e83d26c6d461d8909706de9f04c5415ed779163a","unresolved":false,"context_lines":[{"line_number":892,"context_line":""},{"line_number":893,"context_line":"    @db_test_base.backend_specific(\u0027mysql\u0027, \u0027postgresql\u0027)"},{"line_number":894,"context_line":"    def test_drop_schema(self):"},{"line_number":895,"context_line":"        if self.engine.name \u003d\u003d \u0027postgresql\u0027:"},{"line_number":896,"context_line":"            sql \u003d ("},{"line_number":897,"context_line":"                \"CREATE TYPE mood AS ENUM (\u0027sad\u0027, \u0027ok\u0027, \u0027happy\u0027);\","},{"line_number":898,"context_line":"                \u0027CREATE TABLE ct1 (a INT NOT NULL, mood mood, \u0027"}],"source_content_type":"text/x-python","patch_set":8,"id":"baada198_08b80c74","line":895,"in_reply_to":"baada198_a88f2022","updated":"2014-07-18 16:52:45.000000000","message":"It is impossible to create circular fk dependency with Sqlalchemy.","commit_id":"caebc74b5ec8d4938744609a987a10e2610bf904"},{"author":{"_account_id":6849,"name":"Roman Podoliaka","email":"roman.podoliaka@gmail.com","username":"rpodolyaka"},"change_message_id":"bf7a5b6fc3fce82a297f0ec4e3e3c338ab3fd42e","unresolved":false,"context_lines":[{"line_number":919,"context_line":"                          \u0027ct1\u0027, meta, autoload\u003dTrue)"},{"line_number":920,"context_line":"        self.assertRaises(exc.NoSuchTableError, Table,"},{"line_number":921,"context_line":"                          \u0027ct2\u0027, meta, autoload\u003dTrue)"},{"line_number":922,"context_line":""},{"line_number":923,"context_line":""},{"line_number":924,"context_line":"class TestUtilsMysqlOpportunistically("},{"line_number":925,"context_line":"        TestUtils, db_test_base.MySQLOpportunisticTestCase):"}],"source_content_type":"text/x-python","patch_set":8,"id":"baada198_c8bff4ce","line":922,"updated":"2014-07-18 12:55:16.000000000","message":"This test is missing a check, if all ENUM types have been properly dropped (PostgreSQL only). You could do something like:\n\n  SELECT DISTINCT pg_type.typname AS enumtype FROM pg_type JOIN pg_enum ON pg_enum.enumtypid \u003d pg_type.oid;\n\nto check that","commit_id":"caebc74b5ec8d4938744609a987a10e2610bf904"},{"author":{"_account_id":7536,"name":"Ilya Pekelny","email":"ipekelny@mirantis.com","username":"I159"},"change_message_id":"e83d26c6d461d8909706de9f04c5415ed779163a","unresolved":false,"context_lines":[{"line_number":919,"context_line":"                          \u0027ct1\u0027, meta, autoload\u003dTrue)"},{"line_number":920,"context_line":"        self.assertRaises(exc.NoSuchTableError, Table,"},{"line_number":921,"context_line":"                          \u0027ct2\u0027, meta, autoload\u003dTrue)"},{"line_number":922,"context_line":""},{"line_number":923,"context_line":""},{"line_number":924,"context_line":"class TestUtilsMysqlOpportunistically("},{"line_number":925,"context_line":"        TestUtils, db_test_base.MySQLOpportunisticTestCase):"}],"source_content_type":"text/x-python","patch_set":8,"id":"baada198_4874c4ce","line":922,"in_reply_to":"baada198_c8bff4ce","updated":"2014-07-18 16:52:45.000000000","message":"Whoa! Such a complicated query! Thanks you!","commit_id":"caebc74b5ec8d4938744609a987a10e2610bf904"}]}
