def test_parse_query(self): result = parse_queries( [ {u'sql': u'QUERY = u\'INSERT INTO "sentry_useremail" ("user_id", "email", "validation_hash", "date_hash_added", "is_verified") VALUES (%s, %s, %s, %s, %s)\' - PARAMS = (1, u\'admin@localhost\', u\'i0NlOcwzPKoObK8uNfg7mowTlOnvvlSI\', u\'2018-05-16 08:02:39.022342\', False)', u'time': u'0.000'}, {u'sql': u'QUERY = u\'INSERT INTO "sentry_email" ("email", "date_added") VALUES (%s, %s)\' - PARAMS = (u\'admin@localhost\', u\'2018-05-16 08:02:39.023101\')', u'time': u'0.000'}, {u'sql': u'QUERY = u\'UPDATE "sentry_useremail" SET "is_verified" = %s WHERE ("sentry_useremail"."user_id" = %s AND "sentry_useremail"."email" = %s )\' - PARAMS = (True, 1, u\'admin@localhost\')', u'time': u'0.000'}, {u'sql': u'QUERY = u\'DELETE * FROM "sentry_organization"\' - PARAMS = (u\'baz\', u\'baz\', 0, u\'2018-05-16 08:02:39.025899\', u\'member\', 1)', u'time': u'0.000'}, {u'sql': u'QUERY = u\'INSERT INTO "sentry_organizationmember" ("organization_id", "user_id", "email", "role", "flags", "token", "date_added", "has_global_access", "type") VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)\' - PARAMS = (2, 1, None, u\'owner\', 0, None, u\'2018-05-16 08:02:39.026919\', True, 50)', u'time': u'0.000'}, {u'sql': u'QUERY = u\'UPDATE "sentry_projectoptions" SET "value" = %s WHERE ("sentry_projectoptions"."project_id" = %s AND "sentry_projectoptions"."key" = %s )\' - PARAMS = (u\'gAJYIAAAADgwNmQxZjQ1NThkZjExZTg5ZWExOGM4NTkwMGNhNWI3cQEu\', 2, u\'sentry:relay-rev\')', u'time': u'0.000'}, {u'sql': u'QUERY = u\'UPDATE "sentry_projectoptions" SET "value" = %s WHERE ("sentry_projectoptions"."project_id" = %s AND "sentry_projectoptions"."key" = %s )\' - PARAMS = (u\'gAJjZGF0ZXRpbWUKZGF0ZXRpbWUKcQFVCgfiBRAIAicApBhjcHl0egpfVVRDCnECKVJxA4ZScQQu\', 2, u\'sentry:relay-rev-lastchange\')', u'time': u'0.000'}, {u'sql': u"QUERY = '\\n insert or ignore into sentry_projectcounter\\n (project_id, value) values (%s, 0);\\n ' - PARAMS = (2,)", u'time': u'0.000'}, {u'sql': u"QUERY = '\\n select value from sentry_projectcounter\\n where project_id = %s\\n ' - PARAMS = (2,)", u'time': u'0.000'}, {u'sql': u"QUERY = '\\n update sentry_projectcounter\\n set value = value + %s\\n where project_id = %s;\\n ' - PARAMS = (1, 2)", u'time': u'0.000'}, {u'sql': u"QUERY = '\\n select changes();\\n ' - PARAMS = ()", u'time': u'0.000'}, {u'sql': u'QUERY = u\'INSERT INTO "sentry_groupedmessage" ("project_id", "logger", "level", "message", "view", "num_comments", "platform", "status", "times_seen", "last_seen", "first_seen", "first_release_id", "resolved_at", "active_at", "time_spent_total", "time_spent_count", "score", "is_public", "data", "short_id") VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)\' - PARAMS = (2, u\'\', 40, u\'hello http://example.com\', u\'http://example.com\', 0, u\'javascript\', 0, 1, u\'2018-05-16 08:02:39\', u\'2018-05-16 08:02:39\', None, None, u\'2018-05-16 08:02:39\', 0, 0, 1526457759, False, u\'eJwVykEKg0AMheF9LjKuCk4dx16gFxDcSmgiHYgYOrHg7c0s//e+jrSHOQhWW3/84fJnCqAR3n2K45ByTi+oc7BL2fenW+INTzGvoT07GxIaeifoSEcnVkwaz7B8WeQAnaDWxw3kwCAZ\', 1)', u'time': u'0.000'}, {u'sql': u'QUERY = u\'UPDATE "sentry_grouphash" SET "group_id" = %s WHERE ("sentry_grouphash"."id" IN (%s) AND NOT ("sentry_grouphash"."state" = %s AND "sentry_grouphash"."state" IS NOT NULL))\' - PARAMS = (1, 1, 1)', u'time': u'0.000'}, {u'sql': u'QUERY = u\'UPDATE "sentry_userreport" SET "environment_id" = %s, "group_id" = %s WHERE ("sentry_userreport"."project_id" = %s AND "sentry_userreport"."event_id" = %s )\' - PARAMS = (1, 1, 2, u\'45b41f6d313c442393aaa0293853d70f\')', u'time': u'0.000'}] ) assert result == { 'sentry_email': 1, 'sentry_groupedmessage': 1, 'sentry_grouphash': 1, 'sentry_organization': 1, 'sentry_organizationmember': 1, 'sentry_projectcounter': 2, 'sentry_projectoptions': 2, 'sentry_useremail': 2, 'sentry_userreport': 1 }
def test_parse_postgres_queries(self): result = parse_queries([{ u'sql': u'SAVEPOINT "s47890194282880_x49"', u'time': u'0.000' }, { u'sql': u'RELEASE SAVEPOINT "s47890194282880_x49"', u'time': u'0.000' }, { u'sql': u'SELECT "sentry_rawevent"."id", "sentry_rawevent"."project_id", "sentry_rawevent"."event_id", "sentry_rawevent"."datetime", "sentry_rawevent"."data" FROM "sentry_rawevent" WHERE ("sentry_rawevent"."event_id" = \'1fba9e314001443b93285dc4411f1593\' AND "sentry_rawevent"."project_id" = 864 )', u'time': u'0.000' }, { u'sql': u'SELECT "sentry_reprocessingreport"."id", "sentry_reprocessingreport"."project_id", "sentry_reprocessingreport"."event_id", "sentry_reprocessingreport"."datetime" FROM "sentry_reprocessingreport" WHERE ("sentry_reprocessingreport"."event_id" = \'1fba9e314001443b93285dc4411f1593\' AND "sentry_reprocessingreport"."project_id" = 864 )', u'time': u'0.001' }, { u'sql': u'SELECT "sentry_message"."id", "sentry_message"."group_id", "sentry_message"."message_id", "sentry_message"."project_id", "sentry_message"."message", "sentry_message"."platform", "sentry_message"."datetime", "sentry_message"."time_spent", "sentry_message"."data" FROM "sentry_message" WHERE ("sentry_message"."message_id" = \'1fba9e314001443b93285dc4411f1593\' AND "sentry_message"."project_id" = 864 )', u'time': u'0.001' }, { u'sql': u'SAVEPOINT "s47890194282880_x50"', u'time': u'0.000' }, { u'sql': u'INSERT INTO "sentry_eventuser" ("project_id", "hash", "ident", "email", "username", "name", "ip_address", "date_added") VALUES (864, \'f528764d624db129b32c21fbca0cb8d6\', NULL, NULL, NULL, NULL, \'127.0.0.1\', \'2018-05-22 09:12:12.357888+00:00\') RETURNING "sentry_eventuser"."id"', u'time': u'0.000' }, { u'sql': u'ROLLBACK TO SAVEPOINT "s47890194282880_x50"', u'time': u'0.000' }, { u'sql': u'SELECT "sentry_eventuser"."id", "sentry_eventuser"."project_id", "sentry_eventuser"."hash", "sentry_eventuser"."ident", "sentry_eventuser"."email", "sentry_eventuser"."username", "sentry_eventuser"."name", "sentry_eventuser"."ip_address", "sentry_eventuser"."date_added" FROM "sentry_eventuser" WHERE ("sentry_eventuser"."project_id" = 864 AND "sentry_eventuser"."hash" = \'f528764d624db129b32c21fbca0cb8d6\' )', u'time': u'0.000' }, { u'sql': u'SELECT "sentry_grouphash"."id", "sentry_grouphash"."project_id", "sentry_grouphash"."hash", "sentry_grouphash"."group_id", "sentry_grouphash"."group_tombstone_id", "sentry_grouphash"."state" FROM "sentry_grouphash" WHERE ("sentry_grouphash"."project_id" = 864 AND "sentry_grouphash"."hash" = \'5d41402abc4b2a76b9719d911017c592\' )', u'time': u'0.000' }, { u'sql': u'SELECT "sentry_groupedmessage"."id", "sentry_groupedmessage"."project_id", "sentry_groupedmessage"."logger", "sentry_groupedmessage"."level", "sentry_groupedmessage"."message", "sentry_groupedmessage"."view", "sentry_groupedmessage"."num_comments", "sentry_groupedmessage"."platform", "sentry_groupedmessage"."status", "sentry_groupedmessage"."times_seen", "sentry_groupedmessage"."last_seen", "sentry_groupedmessage"."first_seen", "sentry_groupedmessage"."first_release_id", "sentry_groupedmessage"."resolved_at", "sentry_groupedmessage"."active_at", "sentry_groupedmessage"."time_spent_total", "sentry_groupedmessage"."time_spent_count", "sentry_groupedmessage"."score", "sentry_groupedmessage"."is_public", "sentry_groupedmessage"."data", "sentry_groupedmessage"."short_id" FROM "sentry_groupedmessage" WHERE "sentry_groupedmessage"."id" = 662 ', u'time': u'0.000' }, { u'sql': u'SELECT "sentry_project"."id", "sentry_project"."slug", "sentry_project"."name", "sentry_project"."forced_color", "sentry_project"."organization_id", "sentry_project"."public", "sentry_project"."date_added", "sentry_project"."status", "sentry_project"."first_event", "sentry_project"."flags", "sentry_project"."platform" FROM "sentry_project" WHERE "sentry_project"."id" = 864 ', u'time': u'0.000' }, { u'sql': u'UPDATE "sentry_groupedmessage" SET "times_seen" = "sentry_groupedmessage"."times_seen" + 1, "score" = 1526980332, "data" = \'eJwVyksKhEAMRdF5NlKORKv89QbcgOBUgokopOlgRcHddxze905BWsMUBLMtJ6983EwBNMJYt7H7DFVKEfIU7FH2Pbkl3vAS82re58uGhIbeLRSknRM7TF7ew7yzyA90gJzLP+FOIA0=\', "last_seen" = \'2018-05-22 09:12:12+00:00\' WHERE "sentry_groupedmessage"."id" = 662 ', u'time': u'0.001' }, { u'sql': u'SAVEPOINT "s47890194282880_x51"', u'time': u'0.000' }, { u'sql': u'INSERT INTO "sentry_environmentproject" ("project_id", "environment_id", "is_hidden") VALUES (864, 165, NULL) RETURNING "sentry_environmentproject"."id"', u'time': u'0.000' }, { u'sql': u'ROLLBACK TO SAVEPOINT "s47890194282880_x51"', u'time': u'0.000' }, { u'sql': u'UPDATE "sentry_userreport" SET "environment_id" = 165, "group_id" = 662 WHERE ("sentry_userreport"."project_id" = 864 AND "sentry_userreport"."event_id" = \'1fba9e314001443b93285dc4411f1593\' )', u'time': u'0.000' }, { u'sql': u'SAVEPOINT "s47890194282880_x52"', u'time': u'0.000' }, { u'sql': u'UPDATE "nodestore_node" SET "timestamp" = \'2018-05-22 09:12:12.374085+00:00\', "data" = \'eJxtU8Fu2zAMvesrfIsLbI4lS7KTnYoBW4qu7SFdcgxUm3G0OLEgq127ov8+UnHTSxHACMn3KOo9Km0cZ8uJ8/0fqMOEOcGuKi3ZsJwMcAz+JbPHAH5rahiy3wN4hBQsbZxElnUb0zQehgGzChNclFmOP46xZsOnTW4QblpAREl9KqQdzqkZW+2g63rmeB758By8wQLnBOaCBtt42G6ewA+2P1KpYFfi84EXIThCyEimCR99RwmN52BtPp3Cszm4DrK6P2C+pD47MA12J1zF0s7xGX1FzlYkwNfLFs9BoTgzq5v+n+06M1VZnqRre2z6v0Nye5/oTHxL1ndrLS+SS4f91/BwbcNUFWVW6CS9Xtzf/PqSdHYPyU+o9/1F8n3n+wNMRUX6qTzPSpEszdZ4O7LwSMGMIVXqHu/4HGhEEd0QZEcfYxVjjfGHRKJkt0g7mgOJLEjz92ErSsyi1g8eEyeHc2pScNYiczk5z0QllLqNHU4DU6pAOvK39tiCdx4NoKwk1QoS/fU1aWBrHruQvL1RSTMz+khR+bFyzZ4SVTx9hsy6syj2xpKLMmetJtTHvSRnK9q3HP/GFRhvKAu22rh+CGsbdotoJyZlvKWHGuwTNART7AdXQs+qvCgiH7zvo/NS0/Qy7kMwbUzFZZC4DMtJB09Ai6RyNpIo4Cw4hR6l73umis/3TElCqog8be388aS8ws20bn5+SIQrI64fstPtVmfrqFjF4mjdiHAK39HJHnyHOcI0Lmvaoq1jOjlbSkUceWhJyyjvHl42luTR+LBmyCEJXhz11bRmo5UUKqodIJjGBHqlWpNzmnYm2NBFSsXa+Jaz/zqNSI8=\' WHERE "nodestore_node"."id" = \'u9iv1Ih4RDqz5GtlwX3+TA==\' ', u'time': u'0.000' }, { u'sql': u'SAVEPOINT "s47890194282880_x53"', u'time': u'0.000' }, { u'sql': u'INSERT INTO "nodestore_node" ("id", "data", "timestamp") VALUES (\'u9iv1Ih4RDqz5GtlwX3+TA==\', \'eJxtU8Fu2zAMvesrfIsLbI4lS7KTnYoBW4qu7SFdcgxUm3G0OLEgq127ov8+UnHTSxHACMn3KOo9Km0cZ8uJ8/0fqMOEOcGuKi3ZsJwMcAz+JbPHAH5rahiy3wN4hBQsbZxElnUb0zQehgGzChNclFmOP46xZsOnTW4QblpAREl9KqQdzqkZW+2g63rmeB758By8wQLnBOaCBtt42G6ewA+2P1KpYFfi84EXIThCyEimCR99RwmN52BtPp3Cszm4DrK6P2C+pD47MA12J1zF0s7xGX1FzlYkwNfLFs9BoTgzq5v+n+06M1VZnqRre2z6v0Nye5/oTHxL1ndrLS+SS4f91/BwbcNUFWVW6CS9Xtzf/PqSdHYPyU+o9/1F8n3n+wNMRUX6qTzPSpEszdZ4O7LwSMGMIVXqHu/4HGhEEd0QZEcfYxVjjfGHRKJkt0g7mgOJLEjz92ErSsyi1g8eEyeHc2pScNYiczk5z0QllLqNHU4DU6pAOvK39tiCdx4NoKwk1QoS/fU1aWBrHruQvL1RSTMz+khR+bFyzZ4SVTx9hsy6syj2xpKLMmetJtTHvSRnK9q3HP/GFRhvKAu22rh+CGsbdotoJyZlvKWHGuwTNART7AdXQs+qvCgiH7zvo/NS0/Qy7kMwbUzFZZC4DMtJB09Ai6RyNpIo4Cw4hR6l73umis/3TElCqog8be388aS8ws20bn5+SIQrI64fstPtVmfrqFjF4mjdiHAK39HJHnyHOcI0Lmvaoq1jOjlbSkUceWhJyyjvHl42luTR+LBmyCEJXhz11bRmo5UUKqodIJjGBHqlWpNzmnYm2NBFSsXa+Jaz/zqNSI8=\', \'2018-05-22 09:12:12.374085+00:00\')', u'time': u'0.000' }, { u'sql': u'RELEASE SAVEPOINT "s47890194282880_x53"', u'time': u'0.000' }, { u'sql': u'INSERT INTO "sentry_message" ("group_id", "message_id", "project_id", "message", "platform", "datetime", "time_spent", "data") VALUES (662, \'1fba9e314001443b93285dc4411f1593\', 864, \'hello http://example.com\', \'javascript\', \'2018-05-22 09:12:12+00:00\', NULL, \'eJzTSCkw5ApWz8tPSY3PTFHnKjAC8kotM8sMPTNMglwKq0zdS3LKI4y1QxxtbYHSxlzFegCZxA8W\') RETURNING "sentry_message"."id"', u'time': u'0.000' }, { u'sql': u'RELEASE SAVEPOINT "s47890194282880_x52"', u'time': u'0.000' }, { u'sql': u'SELECT "sentry_filterkey"."id", "sentry_filterkey"."project_id", "sentry_filterkey"."key", "sentry_filterkey"."values_seen", "sentry_filterkey"."label", "sentry_filterkey"."status" FROM "sentry_filterkey" WHERE ("sentry_filterkey"."project_id" = 864 AND "sentry_filterkey"."key" = \'level\' )', u'time': u'0.001' }, { u'sql': u'SELECT "sentry_filtervalue"."id", "sentry_filtervalue"."project_id", "sentry_filtervalue"."key", "sentry_filtervalue"."value", "sentry_filtervalue"."data", "sentry_filtervalue"."times_seen", "sentry_filtervalue"."last_seen", "sentry_filtervalue"."first_seen" FROM "sentry_filtervalue" WHERE ("sentry_filtervalue"."project_id" = 864 AND "sentry_filtervalue"."value" = \'error\' AND "sentry_filtervalue"."key" = \'level\' )', u'time': u'0.000' }, { u'sql': u'SELECT "sentry_filterkey"."id", "sentry_filterkey"."project_id", "sentry_filterkey"."key", "sentry_filterkey"."values_seen", "sentry_filterkey"."label", "sentry_filterkey"."status" FROM "sentry_filterkey" WHERE ("sentry_filterkey"."project_id" = 864 AND "sentry_filterkey"."key" = \'url\' )', u'time': u'0.001' }, { u'sql': u'SELECT "sentry_filtervalue"."id", "sentry_filtervalue"."project_id", "sentry_filtervalue"."key", "sentry_filtervalue"."value", "sentry_filtervalue"."data", "sentry_filtervalue"."times_seen", "sentry_filtervalue"."last_seen", "sentry_filtervalue"."first_seen" FROM "sentry_filtervalue" WHERE ("sentry_filtervalue"."project_id" = 864 AND "sentry_filtervalue"."value" = \'http://example.com\' AND "sentry_filtervalue"."key" = \'url\' )', u'time': u'0.000' }, { u'sql': u'SELECT "sentry_filterkey"."id", "sentry_filterkey"."project_id", "sentry_filterkey"."key", "sentry_filterkey"."values_seen", "sentry_filterkey"."label", "sentry_filterkey"."status" FROM "sentry_filterkey" WHERE ("sentry_filterkey"."project_id" = 864 AND "sentry_filterkey"."key" = \'sentry:user\' )', u'time': u'0.000' }, { u'sql': u'SELECT "sentry_filtervalue"."id", "sentry_filtervalue"."project_id", "sentry_filtervalue"."key", "sentry_filtervalue"."value", "sentry_filtervalue"."data", "sentry_filtervalue"."times_seen", "sentry_filtervalue"."last_seen", "sentry_filtervalue"."first_seen" FROM "sentry_filtervalue" WHERE ("sentry_filtervalue"."project_id" = 864 AND "sentry_filtervalue"."value" = \'ip:127.0.0.1\' AND "sentry_filtervalue"."key" = \'sentry:user\' )', u'time': u'0.000' }, { u'sql': u'SELECT "sentry_filterkey"."id", "sentry_filterkey"."project_id", "sentry_filterkey"."key", "sentry_filterkey"."values_seen", "sentry_filterkey"."label", "sentry_filterkey"."status" FROM "sentry_filterkey" WHERE ("sentry_filterkey"."project_id" = 864 AND "sentry_filterkey"."key" = \'os.name\' )', u'time': u'0.000' }, { u'sql': u'SELECT "sentry_filtervalue"."id", "sentry_filtervalue"."project_id", "sentry_filtervalue"."key", "sentry_filtervalue"."value", "sentry_filtervalue"."data", "sentry_filtervalue"."times_seen", "sentry_filtervalue"."last_seen", "sentry_filtervalue"."first_seen" FROM "sentry_filtervalue" WHERE ("sentry_filtervalue"."project_id" = 864 AND "sentry_filtervalue"."value" = \'Windows 8\' AND "sentry_filtervalue"."key" = \'os.name\' )', u'time': u'0.000' }, { u'sql': u'SELECT "sentry_filterkey"."id", "sentry_filterkey"."project_id", "sentry_filterkey"."key", "sentry_filterkey"."values_seen", "sentry_filterkey"."label", "sentry_filterkey"."status" FROM "sentry_filterkey" WHERE ("sentry_filterkey"."project_id" = 864 AND "sentry_filterkey"."key" = \'browser.name\' )', u'time': u'0.000' }, { u'sql': u'SELECT "sentry_filtervalue"."id", "sentry_filtervalue"."project_id", "sentry_filtervalue"."key", "sentry_filtervalue"."value", "sentry_filtervalue"."data", "sentry_filtervalue"."times_seen", "sentry_filtervalue"."last_seen", "sentry_filtervalue"."first_seen" FROM "sentry_filtervalue" WHERE ("sentry_filtervalue"."project_id" = 864 AND "sentry_filtervalue"."value" = \'Chrome\' AND "sentry_filtervalue"."key" = \'browser.name\' )', u'time': u'0.000' }, { u'sql': u'SELECT "sentry_filterkey"."id", "sentry_filterkey"."project_id", "sentry_filterkey"."key", "sentry_filterkey"."values_seen", "sentry_filterkey"."label", "sentry_filterkey"."status" FROM "sentry_filterkey" WHERE ("sentry_filterkey"."project_id" = 864 AND "sentry_filterkey"."key" = \'browser\' )', u'time': u'0.000' }, { u'sql': u'SELECT "sentry_filtervalue"."id", "sentry_filtervalue"."project_id", "sentry_filtervalue"."key", "sentry_filtervalue"."value", "sentry_filtervalue"."data", "sentry_filtervalue"."times_seen", "sentry_filtervalue"."last_seen", "sentry_filtervalue"."first_seen" FROM "sentry_filtervalue" WHERE ("sentry_filtervalue"."project_id" = 864 AND "sentry_filtervalue"."value" = \'Chrome 28.0.1500\' AND "sentry_filtervalue"."key" = \'browser\' )', u'time': u'0.000' }, { u'sql': u'SAVEPOINT "s47890194282880_x54"', u'time': u'0.000' }, { u'sql': u'INSERT INTO "sentry_eventtag" ("project_id", "group_id", "event_id", "key_id", "value_id", "date_added") VALUES (864, 662, 454, 108, 108, \'2018-05-22 09:12:12+00:00\'), (864, 662, 454, 109, 109, \'2018-05-22 09:12:12+00:00\'), (864, 662, 454, 110, 110, \'2018-05-22 09:12:12+00:00\'), (864, 662, 454, 111, 111, \'2018-05-22 09:12:12+00:00\'), (864, 662, 454, 112, 112, \'2018-05-22 09:12:12+00:00\'), (864, 662, 454, 113, 113, \'2018-05-22 09:12:12+00:00\')', u'time': u'0.000' }, { u'sql': u'RELEASE SAVEPOINT "s47890194282880_x54"', u'time': u'0.000' }, { u'sql': u'UPDATE "sentry_filtervalue" SET "times_seen" = "sentry_filtervalue"."times_seen" + 1, "data" = NULL, "last_seen" = \'2018-05-22 09:12:12+00:00\' WHERE ("sentry_filtervalue"."project_id" = 864 AND "sentry_filtervalue"."value" = \'error\' AND "sentry_filtervalue"."key" = \'level\' )', u'time': u'0.001' }, { u'sql': u'UPDATE "sentry_messagefiltervalue" SET "times_seen" = "sentry_messagefiltervalue"."times_seen" + 1, "project_id" = 864, "last_seen" = \'2018-05-22 09:12:12+00:00\' WHERE ("sentry_messagefiltervalue"."group_id" = 662 AND "sentry_messagefiltervalue"."value" = \'error\' AND "sentry_messagefiltervalue"."key" = \'level\' )', u'time': u'0.000' }, { u'sql': u'UPDATE "sentry_filtervalue" SET "times_seen" = "sentry_filtervalue"."times_seen" + 1, "data" = NULL, "last_seen" = \'2018-05-22 09:12:12+00:00\' WHERE ("sentry_filtervalue"."project_id" = 864 AND "sentry_filtervalue"."value" = \'http://example.com\' AND "sentry_filtervalue"."key" = \'url\' )', u'time': u'0.001' }, { u'sql': u'UPDATE "sentry_messagefiltervalue" SET "times_seen" = "sentry_messagefiltervalue"."times_seen" + 1, "project_id" = 864, "last_seen" = \'2018-05-22 09:12:12+00:00\' WHERE ("sentry_messagefiltervalue"."group_id" = 662 AND "sentry_messagefiltervalue"."value" = \'http://example.com\' AND "sentry_messagefiltervalue"."key" = \'url\' )', u'time': u'0.001' }, { u'sql': u'UPDATE "sentry_filtervalue" SET "times_seen" = "sentry_filtervalue"."times_seen" + 1, "data" = NULL, "last_seen" = \'2018-05-22 09:12:12+00:00\' WHERE ("sentry_filtervalue"."project_id" = 864 AND "sentry_filtervalue"."value" = \'ip:127.0.0.1\' AND "sentry_filtervalue"."key" = \'sentry:user\' )', u'time': u'0.001' }, { u'sql': u'UPDATE "sentry_messagefiltervalue" SET "times_seen" = "sentry_messagefiltervalue"."times_seen" + 1, "project_id" = 864, "last_seen" = \'2018-05-22 09:12:12+00:00\' WHERE ("sentry_messagefiltervalue"."group_id" = 662 AND "sentry_messagefiltervalue"."value" = \'ip:127.0.0.1\' AND "sentry_messagefiltervalue"."key" = \'sentry:user\' )', u'time': u'0.001' }, { u'sql': u'UPDATE "sentry_filtervalue" SET "times_seen" = "sentry_filtervalue"."times_seen" + 1, "data" = NULL, "last_seen" = \'2018-05-22 09:12:12+00:00\' WHERE ("sentry_filtervalue"."project_id" = 864 AND "sentry_filtervalue"."value" = \'Windows 8\' AND "sentry_filtervalue"."key" = \'os.name\' )', u'time': u'0.001' }, { u'sql': u'UPDATE "sentry_messagefiltervalue" SET "times_seen" = "sentry_messagefiltervalue"."times_seen" + 1, "project_id" = 864, "last_seen" = \'2018-05-22 09:12:12+00:00\' WHERE ("sentry_messagefiltervalue"."group_id" = 662 AND "sentry_messagefiltervalue"."value" = \'Windows 8\' AND "sentry_messagefiltervalue"."key" = \'os.name\' )', u'time': u'0.001' }, { u'sql': u'UPDATE "sentry_filtervalue" SET "times_seen" = "sentry_filtervalue"."times_seen" + 1, "data" = NULL, "last_seen" = \'2018-05-22 09:12:12+00:00\' WHERE ("sentry_filtervalue"."project_id" = 864 AND "sentry_filtervalue"."value" = \'Chrome\' AND "sentry_filtervalue"."key" = \'browser.name\' )', u'time': u'0.001' }, { u'sql': u'UPDATE "sentry_messagefiltervalue" SET "times_seen" = "sentry_messagefiltervalue"."times_seen" + 1, "project_id" = 864, "last_seen" = \'2018-05-22 09:12:12+00:00\' WHERE ("sentry_messagefiltervalue"."group_id" = 662 AND "sentry_messagefiltervalue"."value" = \'Chrome\' AND "sentry_messagefiltervalue"."key" = \'browser.name\' )', u'time': u'0.001' }, { u'sql': u'UPDATE "sentry_filtervalue" SET "times_seen" = "sentry_filtervalue"."times_seen" + 1, "data" = NULL, "last_seen" = \'2018-05-22 09:12:12+00:00\' WHERE ("sentry_filtervalue"."project_id" = 864 AND "sentry_filtervalue"."value" = \'Chrome 28.0.1500\' AND "sentry_filtervalue"."key" = \'browser\' )', u'time': u'0.001' }, { u'sql': u'UPDATE "sentry_messagefiltervalue" SET "times_seen" = "sentry_messagefiltervalue"."times_seen" + 1, "project_id" = 864, "last_seen" = \'2018-05-22 09:12:12+00:00\' WHERE ("sentry_messagefiltervalue"."group_id" = 662 AND "sentry_messagefiltervalue"."value" = \'Chrome 28.0.1500\' AND "sentry_messagefiltervalue"."key" = \'browser\' )', u'time': u'0.001' }, { u'sql': u'SELECT "sentry_groupedmessage"."id", "sentry_groupedmessage"."project_id", "sentry_groupedmessage"."logger", "sentry_groupedmessage"."level", "sentry_groupedmessage"."message", "sentry_groupedmessage"."view", "sentry_groupedmessage"."num_comments", "sentry_groupedmessage"."platform", "sentry_groupedmessage"."status", "sentry_groupedmessage"."times_seen", "sentry_groupedmessage"."last_seen", "sentry_groupedmessage"."first_seen", "sentry_groupedmessage"."first_release_id", "sentry_groupedmessage"."resolved_at", "sentry_groupedmessage"."active_at", "sentry_groupedmessage"."time_spent_total", "sentry_groupedmessage"."time_spent_count", "sentry_groupedmessage"."score", "sentry_groupedmessage"."is_public", "sentry_groupedmessage"."data", "sentry_groupedmessage"."short_id" FROM "sentry_groupedmessage" WHERE "sentry_groupedmessage"."id" = 662 ', u'time': u'0.001' }, { u'sql': u'SELECT "sentry_groupsnooze"."id", "sentry_groupsnooze"."group_id", "sentry_groupsnooze"."until", "sentry_groupsnooze"."count", "sentry_groupsnooze"."window", "sentry_groupsnooze"."user_count", "sentry_groupsnooze"."user_window", "sentry_groupsnooze"."state", "sentry_groupsnooze"."actor_id" FROM "sentry_groupsnooze" WHERE "sentry_groupsnooze"."group_id" = 662 ', u'time': u'0.000' }, { u'sql': u'SELECT "sentry_grouprulestatus"."id", "sentry_grouprulestatus"."project_id", "sentry_grouprulestatus"."rule_id", "sentry_grouprulestatus"."group_id", "sentry_grouprulestatus"."status", "sentry_grouprulestatus"."date_added", "sentry_grouprulestatus"."last_active" FROM "sentry_grouprulestatus" WHERE ("sentry_grouprulestatus"."group_id" = 662 AND "sentry_grouprulestatus"."rule_id" = 935 )', u'time': u'0.000' }, { u'sql': u'SAVEPOINT "s47890194282880_x55"', u'time': u'0.000' }, { u'sql': u'RELEASE SAVEPOINT "s47890194282880_x55"', u'time': u'0.000' }]) assert result == { 'nodestore_node': 2, 'sentry_environmentproject': 1, 'sentry_eventtag': 1, 'sentry_eventuser': 1, 'sentry_filtervalue': 6, 'sentry_groupedmessage': 1, 'sentry_message': 1, 'sentry_messagefiltervalue': 6, 'sentry_userreport': 1 }
def test_parse_query(self): result = parse_queries([{ u'sql': u'QUERY = u\'INSERT INTO "sentry_useremail" ("user_id", "email", "validation_hash", "date_hash_added", "is_verified") VALUES (%s, %s, %s, %s, %s)\' - PARAMS = (1, u\'admin@localhost\', u\'i0NlOcwzPKoObK8uNfg7mowTlOnvvlSI\', u\'2018-05-16 08:02:39.022342\', False)', u'time': u'0.000' }, { u'sql': u'QUERY = u\'INSERT INTO "sentry_email" ("email", "date_added") VALUES (%s, %s)\' - PARAMS = (u\'admin@localhost\', u\'2018-05-16 08:02:39.023101\')', u'time': u'0.000' }, { u'sql': u'QUERY = u\'UPDATE "sentry_useremail" SET "is_verified" = %s WHERE ("sentry_useremail"."user_id" = %s AND "sentry_useremail"."email" = %s )\' - PARAMS = (True, 1, u\'admin@localhost\')', u'time': u'0.000' }, { u'sql': u'QUERY = u\'DELETE * FROM "sentry_organization"\' - PARAMS = (u\'baz\', u\'baz\', 0, u\'2018-05-16 08:02:39.025899\', u\'member\', 1)', u'time': u'0.000' }, { u'sql': u'QUERY = u\'INSERT INTO "sentry_organizationmember" ("organization_id", "user_id", "email", "role", "flags", "token", "date_added", "has_global_access", "type") VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)\' - PARAMS = (2, 1, None, u\'owner\', 0, None, u\'2018-05-16 08:02:39.026919\', True, 50)', u'time': u'0.000' }, { u'sql': u'QUERY = u\'UPDATE "sentry_projectoptions" SET "value" = %s WHERE ("sentry_projectoptions"."project_id" = %s AND "sentry_projectoptions"."key" = %s )\' - PARAMS = (u\'gAJYIAAAADgwNmQxZjQ1NThkZjExZTg5ZWExOGM4NTkwMGNhNWI3cQEu\', 2, u\'sentry:relay-rev\')', u'time': u'0.000' }, { u'sql': u'QUERY = u\'UPDATE "sentry_projectoptions" SET "value" = %s WHERE ("sentry_projectoptions"."project_id" = %s AND "sentry_projectoptions"."key" = %s )\' - PARAMS = (u\'gAJjZGF0ZXRpbWUKZGF0ZXRpbWUKcQFVCgfiBRAIAicApBhjcHl0egpfVVRDCnECKVJxA4ZScQQu\', 2, u\'sentry:relay-rev-lastchange\')', u'time': u'0.000' }, { u'sql': u"QUERY = '\\n insert or ignore into sentry_projectcounter\\n (project_id, value) values (%s, 0);\\n ' - PARAMS = (2,)", u'time': u'0.000' }, { u'sql': u"QUERY = '\\n select value from sentry_projectcounter\\n where project_id = %s\\n ' - PARAMS = (2,)", u'time': u'0.000' }, { u'sql': u"QUERY = '\\n update sentry_projectcounter\\n set value = value + %s\\n where project_id = %s;\\n ' - PARAMS = (1, 2)", u'time': u'0.000' }, { u'sql': u"QUERY = '\\n select changes();\\n ' - PARAMS = ()", u'time': u'0.000' }, { u'sql': u'QUERY = u\'INSERT INTO "sentry_groupedmessage" ("project_id", "logger", "level", "message", "view", "num_comments", "platform", "status", "times_seen", "last_seen", "first_seen", "first_release_id", "resolved_at", "active_at", "time_spent_total", "time_spent_count", "score", "is_public", "data", "short_id") VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)\' - PARAMS = (2, u\'\', 40, u\'hello http://example.com\', u\'http://example.com\', 0, u\'javascript\', 0, 1, u\'2018-05-16 08:02:39\', u\'2018-05-16 08:02:39\', None, None, u\'2018-05-16 08:02:39\', 0, 0, 1526457759, False, u\'eJwVykEKg0AMheF9LjKuCk4dx16gFxDcSmgiHYgYOrHg7c0s//e+jrSHOQhWW3/84fJnCqAR3n2K45ByTi+oc7BL2fenW+INTzGvoT07GxIaeifoSEcnVkwaz7B8WeQAnaDWxw3kwCAZ\', 1)', u'time': u'0.000' }, { u'sql': u'QUERY = u\'UPDATE "sentry_grouphash" SET "group_id" = %s WHERE ("sentry_grouphash"."id" IN (%s) AND NOT ("sentry_grouphash"."state" = %s AND "sentry_grouphash"."state" IS NOT NULL))\' - PARAMS = (1, 1, 1)', u'time': u'0.000' }, { u'sql': u'QUERY = u\'UPDATE "sentry_userreport" SET "environment_id" = %s, "group_id" = %s WHERE ("sentry_userreport"."project_id" = %s AND "sentry_userreport"."event_id" = %s )\' - PARAMS = (1, 1, 2, u\'45b41f6d313c442393aaa0293853d70f\')', u'time': u'0.000' }]) assert result == { 'sentry_email': 1, 'sentry_groupedmessage': 1, 'sentry_grouphash': 1, 'sentry_organization': 1, 'sentry_organizationmember': 1, 'sentry_projectcounter': 2, 'sentry_projectoptions': 2, 'sentry_useremail': 2, 'sentry_userreport': 1 }
def test_parse_mysql_queries(self): result = parse_queries([{ u'sql': u'SAVEPOINT `s47055674149248_x49`', u'time': u'0.000' }, { u'sql': u'RELEASE SAVEPOINT `s47055674149248_x49`', u'time': u'0.000' }, { u'sql': u"SELECT `sentry_rawevent`.`id`, `sentry_rawevent`.`project_id`, `sentry_rawevent`.`event_id`, `sentry_rawevent`.`datetime`, `sentry_rawevent`.`data` FROM `sentry_rawevent` WHERE (`sentry_rawevent`.`event_id` = '1fa6e7d1c2674273be07852952e1bafc' AND `sentry_rawevent`.`project_id` = 815 )", u'time': u'0.000' }, { u'sql': u"SELECT `sentry_reprocessingreport`.`id`, `sentry_reprocessingreport`.`project_id`, `sentry_reprocessingreport`.`event_id`, `sentry_reprocessingreport`.`datetime` FROM `sentry_reprocessingreport` WHERE (`sentry_reprocessingreport`.`event_id` = '1fa6e7d1c2674273be07852952e1bafc' AND `sentry_reprocessingreport`.`project_id` = 815 )", u'time': u'0.000' }, { u'sql': u"SELECT `sentry_message`.`id`, `sentry_message`.`group_id`, `sentry_message`.`message_id`, `sentry_message`.`project_id`, `sentry_message`.`message`, `sentry_message`.`platform`, `sentry_message`.`datetime`, `sentry_message`.`time_spent`, `sentry_message`.`data` FROM `sentry_message` WHERE (`sentry_message`.`message_id` = '1fa6e7d1c2674273be07852952e1bafc' AND `sentry_message`.`project_id` = 815 )", u'time': u'0.000' }, { u'sql': u'SAVEPOINT `s47055674149248_x50`', u'time': u'0.000' }, { u'sql': u"INSERT INTO `sentry_eventuser` (`project_id`, `hash`, `ident`, `email`, `username`, `name`, `ip_address`, `date_added`) VALUES (815, 'f528764d624db129b32c21fbca0cb8d6', NULL, NULL, NULL, NULL, '127.0.0.1', '2018-05-22 10:54:14')", u'time': u'0.000' }, { u'sql': u'ROLLBACK TO SAVEPOINT `s47055674149248_x50`', u'time': u'0.000' }, { u'sql': u"SELECT `sentry_eventuser`.`id`, `sentry_eventuser`.`project_id`, `sentry_eventuser`.`hash`, `sentry_eventuser`.`ident`, `sentry_eventuser`.`email`, `sentry_eventuser`.`username`, `sentry_eventuser`.`name`, `sentry_eventuser`.`ip_address`, `sentry_eventuser`.`date_added` FROM `sentry_eventuser` WHERE (`sentry_eventuser`.`project_id` = 815 AND `sentry_eventuser`.`hash` = 'f528764d624db129b32c21fbca0cb8d6' )", u'time': u'0.000' }, { u'sql': u"SELECT `sentry_grouphash`.`id`, `sentry_grouphash`.`project_id`, `sentry_grouphash`.`hash`, `sentry_grouphash`.`group_id`, `sentry_grouphash`.`group_tombstone_id`, `sentry_grouphash`.`state` FROM `sentry_grouphash` WHERE (`sentry_grouphash`.`project_id` = 815 AND `sentry_grouphash`.`hash` = '5d41402abc4b2a76b9719d911017c592' )", u'time': u'0.000' }, { u'sql': u'SELECT `sentry_groupedmessage`.`id`, `sentry_groupedmessage`.`project_id`, `sentry_groupedmessage`.`logger`, `sentry_groupedmessage`.`level`, `sentry_groupedmessage`.`message`, `sentry_groupedmessage`.`view`, `sentry_groupedmessage`.`num_comments`, `sentry_groupedmessage`.`platform`, `sentry_groupedmessage`.`status`, `sentry_groupedmessage`.`times_seen`, `sentry_groupedmessage`.`last_seen`, `sentry_groupedmessage`.`first_seen`, `sentry_groupedmessage`.`first_release_id`, `sentry_groupedmessage`.`resolved_at`, `sentry_groupedmessage`.`active_at`, `sentry_groupedmessage`.`time_spent_total`, `sentry_groupedmessage`.`time_spent_count`, `sentry_groupedmessage`.`score`, `sentry_groupedmessage`.`is_public`, `sentry_groupedmessage`.`data`, `sentry_groupedmessage`.`short_id` FROM `sentry_groupedmessage` WHERE `sentry_groupedmessage`.`id` = 592 ', u'time': u'0.001' }, { u'sql': u'SELECT `sentry_project`.`id`, `sentry_project`.`slug`, `sentry_project`.`name`, `sentry_project`.`forced_color`, `sentry_project`.`organization_id`, `sentry_project`.`public`, `sentry_project`.`date_added`, `sentry_project`.`status`, `sentry_project`.`first_event`, `sentry_project`.`flags`, `sentry_project`.`platform` FROM `sentry_project` WHERE `sentry_project`.`id` = 815 ', u'time': u'0.000' }, { u'sql': u"UPDATE `sentry_groupedmessage` SET `times_seen` = `sentry_groupedmessage`.`times_seen` + 1, `score` = log(times_seen) * 600 + unix_timestamp(last_seen), `data` = 'eJwdyk0Kg0AMhuF9LjKuBH9mHC/gBQS3JZgUB1IanCj09k27fL/vaUg7WINgtcfJO5ebKYD2sHSxT3NOYxyhrsE+yr4PbomfeIl5/Z8XGxIaekdoSJMTKyY/PsF2sMgbNEOt7RfkkiAY', `last_seen` = '2018-05-22 10:54:14' WHERE `sentry_groupedmessage`.`id` = 592 ", u'time': u'0.000' }, { u'sql': u'SAVEPOINT `s47055674149248_x51`', u'time': u'0.000' }, { u'sql': u'INSERT INTO `sentry_environmentproject` (`project_id`, `environment_id`, `is_hidden`) VALUES (815, 96, NULL)', u'time': u'0.000' }, { u'sql': u'ROLLBACK TO SAVEPOINT `s47055674149248_x51`', u'time': u'0.000' }, { u'sql': u"UPDATE `sentry_userreport` SET `environment_id` = 96, `group_id` = 592 WHERE (`sentry_userreport`.`project_id` = 815 AND `sentry_userreport`.`event_id` = '1fa6e7d1c2674273be07852952e1bafc' )", u'time': u'0.000' }, { u'sql': u'SAVEPOINT `s47055674149248_x52`', u'time': u'0.000' }, { u'sql': u"UPDATE `nodestore_node` SET `timestamp` = '2018-05-22 10:54:14', `data` = 'eJxtU01v2zAMvetX6BYX2BxLtmSnOxUDtgz92CFdcgxUm3G0OLEgK127ov99pOKmOxQBjJB8pKj3npLGCbaYON//hjpMmJPsphLqhg2LyQCH4J9TewjgN6aGIf01gEdMzpLGFdhm3do0jYdhwKzChJBlmuFPYKzZ8OGQW4SbFhBR0pwK2/bn1Iwtt9B1PXMii/3wFLzBghAEFpIWW3vYrB/BD7Y/UClnP+THC89DcIQoYjNtePQdJTSeg7XL6RSezN51kNb9HvMlzdmCaXA64SqWdE7M6CsztiQCPl+1eA4yJZhZ3vZ/bdeZqUoznqzsoen/DPzunutUfuGrnytdXPArh/NX8HBtw1TlZZprnlzP729vPvHO7oB/h3rXX/CvW9/vYSor4k9lWVpKvjAb4+3YhUdKZgyxUvd4x6dAK8qohiQ5+hirGGuM3ymSJbvDtoPZE8mSOH9btqLELHL94DFxUjijIblgLXYuJuedqIRUt3HCaWFK5diO/Rt7aME7jwJQtiDWciL95YU3sDHHLvDXVyppZkYdKSr/81yzo0wVj59ha91ZZHttScYiY60m1PvFCsGWZLgM/0YPjFcscrZcu34IKxu286gnJot4TQ812EdoCKbYN6GknlW6UAX1g/d9lL7QtH4RDRFMG1PRDQW6YTHp4BHISSpjYxMFggWnUKTkzWgq/9hoeBgiVUSebHt5PFGv0JrWXZ5fEuHKiOuH9HS75Vk7KlaxOGo3IpzCh3TSBx9ihjCNbk1a1HVM87OmVMSVh5a4jPTu4HltiR6dozJSRmXCs6PBmow2ikmhotoegmlMoHeqNUmnyTXBhi62VKyNrzn9By1kSX8=' WHERE `nodestore_node`.`id` = '9cwO83agTCqM5QNjewZF+g==' ", u'time': u'0.000' }, { u'sql': u'SAVEPOINT `s47055674149248_x53`', u'time': u'0.000' }, { u'sql': u"INSERT INTO `nodestore_node` (`id`, `data`, `timestamp`) VALUES ('9cwO83agTCqM5QNjewZF+g==', 'eJxtU01v2zAMvetX6BYX2BxLtmSnOxUDtgz92CFdcgxUm3G0OLEgK127ov99pOKmOxQBjJB8pKj3npLGCbaYON//hjpMmJPsphLqhg2LyQCH4J9TewjgN6aGIf01gEdMzpLGFdhm3do0jYdhwKzChJBlmuFPYKzZ8OGQW4SbFhBR0pwK2/bn1Iwtt9B1PXMii/3wFLzBghAEFpIWW3vYrB/BD7Y/UClnP+THC89DcIQoYjNtePQdJTSeg7XL6RSezN51kNb9HvMlzdmCaXA64SqWdE7M6CsztiQCPl+1eA4yJZhZ3vZ/bdeZqUoznqzsoen/DPzunutUfuGrnytdXPArh/NX8HBtw1TlZZprnlzP729vPvHO7oB/h3rXX/CvW9/vYSor4k9lWVpKvjAb4+3YhUdKZgyxUvd4x6dAK8qohiQ5+hirGGuM3ymSJbvDtoPZE8mSOH9btqLELHL94DFxUjijIblgLXYuJuedqIRUt3HCaWFK5diO/Rt7aME7jwJQtiDWciL95YU3sDHHLvDXVyppZkYdKSr/81yzo0wVj59ha91ZZHttScYiY60m1PvFCsGWZLgM/0YPjFcscrZcu34IKxu286gnJot4TQ812EdoCKbYN6GknlW6UAX1g/d9lL7QtH4RDRFMG1PRDQW6YTHp4BHISSpjYxMFggWnUKTkzWgq/9hoeBgiVUSebHt5PFGv0JrWXZ5fEuHKiOuH9HS75Vk7KlaxOGo3IpzCh3TSBx9ihjCNbk1a1HVM87OmVMSVh5a4jPTu4HltiR6dozJSRmXCs6PBmow2ikmhotoegmlMoHeqNUmnyTXBhi62VKyNrzn9By1kSX8=', '2018-05-22 10:54:14')", u'time': u'0.000' }, { u'sql': u'RELEASE SAVEPOINT `s47055674149248_x53`', u'time': u'0.000' }, { u'sql': u"INSERT INTO `sentry_message` (`group_id`, `message_id`, `project_id`, `message`, `platform`, `datetime`, `time_spent`, `data`) VALUES (592, '1fa6e7d1c2674273be07852952e1bafc', 815, 'hello http://example.com', 'javascript', '2018-05-22 10:54:14', NULL, 'eJzTSCkw5ApWz8tPSY3PTFHnKjAC8iyTy/0tjBPTQ5wLfU0D/bJSy6PctNNtbYHSxlzFegCVlg8K')", u'time': u'0.000' }, { u'sql': u'RELEASE SAVEPOINT `s47055674149248_x52`', u'time': u'0.000' }, { u'sql': u"SELECT `sentry_filterkey`.`id`, `sentry_filterkey`.`project_id`, `sentry_filterkey`.`key`, `sentry_filterkey`.`values_seen`, `sentry_filterkey`.`label`, `sentry_filterkey`.`status` FROM `sentry_filterkey` WHERE (`sentry_filterkey`.`project_id` = 815 AND `sentry_filterkey`.`key` = 'level' )", u'time': u'0.001' }, { u'sql': u"SELECT `sentry_filtervalue`.`id`, `sentry_filtervalue`.`project_id`, `sentry_filtervalue`.`key`, `sentry_filtervalue`.`value`, `sentry_filtervalue`.`data`, `sentry_filtervalue`.`times_seen`, `sentry_filtervalue`.`last_seen`, `sentry_filtervalue`.`first_seen` FROM `sentry_filtervalue` WHERE (`sentry_filtervalue`.`project_id` = 815 AND `sentry_filtervalue`.`value` = 'error' AND `sentry_filtervalue`.`key` = 'level' )", u'time': u'0.000' }, { u'sql': u"SELECT `sentry_filterkey`.`id`, `sentry_filterkey`.`project_id`, `sentry_filterkey`.`key`, `sentry_filterkey`.`values_seen`, `sentry_filterkey`.`label`, `sentry_filterkey`.`status` FROM `sentry_filterkey` WHERE (`sentry_filterkey`.`project_id` = 815 AND `sentry_filterkey`.`key` = 'url' )", u'time': u'0.000' }, { u'sql': u"SELECT `sentry_filtervalue`.`id`, `sentry_filtervalue`.`project_id`, `sentry_filtervalue`.`key`, `sentry_filtervalue`.`value`, `sentry_filtervalue`.`data`, `sentry_filtervalue`.`times_seen`, `sentry_filtervalue`.`last_seen`, `sentry_filtervalue`.`first_seen` FROM `sentry_filtervalue` WHERE (`sentry_filtervalue`.`project_id` = 815 AND `sentry_filtervalue`.`value` = 'http://example.com' AND `sentry_filtervalue`.`key` = 'url' )", u'time': u'0.000' }, { u'sql': u"SELECT `sentry_filterkey`.`id`, `sentry_filterkey`.`project_id`, `sentry_filterkey`.`key`, `sentry_filterkey`.`values_seen`, `sentry_filterkey`.`label`, `sentry_filterkey`.`status` FROM `sentry_filterkey` WHERE (`sentry_filterkey`.`project_id` = 815 AND `sentry_filterkey`.`key` = 'sentry:user' )", u'time': u'0.000' }, { u'sql': u"SELECT `sentry_filtervalue`.`id`, `sentry_filtervalue`.`project_id`, `sentry_filtervalue`.`key`, `sentry_filtervalue`.`value`, `sentry_filtervalue`.`data`, `sentry_filtervalue`.`times_seen`, `sentry_filtervalue`.`last_seen`, `sentry_filtervalue`.`first_seen` FROM `sentry_filtervalue` WHERE (`sentry_filtervalue`.`project_id` = 815 AND `sentry_filtervalue`.`value` = 'ip:127.0.0.1' AND `sentry_filtervalue`.`key` = 'sentry:user' )", u'time': u'0.000' }, { u'sql': u"SELECT `sentry_filterkey`.`id`, `sentry_filterkey`.`project_id`, `sentry_filterkey`.`key`, `sentry_filterkey`.`values_seen`, `sentry_filterkey`.`label`, `sentry_filterkey`.`status` FROM `sentry_filterkey` WHERE (`sentry_filterkey`.`project_id` = 815 AND `sentry_filterkey`.`key` = 'os.name' )", u'time': u'0.000' }, { u'sql': u"SELECT `sentry_filtervalue`.`id`, `sentry_filtervalue`.`project_id`, `sentry_filtervalue`.`key`, `sentry_filtervalue`.`value`, `sentry_filtervalue`.`data`, `sentry_filtervalue`.`times_seen`, `sentry_filtervalue`.`last_seen`, `sentry_filtervalue`.`first_seen` FROM `sentry_filtervalue` WHERE (`sentry_filtervalue`.`project_id` = 815 AND `sentry_filtervalue`.`value` = 'Windows 8' AND `sentry_filtervalue`.`key` = 'os.name' )", u'time': u'0.000' }, { u'sql': u"SELECT `sentry_filterkey`.`id`, `sentry_filterkey`.`project_id`, `sentry_filterkey`.`key`, `sentry_filterkey`.`values_seen`, `sentry_filterkey`.`label`, `sentry_filterkey`.`status` FROM `sentry_filterkey` WHERE (`sentry_filterkey`.`project_id` = 815 AND `sentry_filterkey`.`key` = 'browser.name' )", u'time': u'0.000' }, { u'sql': u"SELECT `sentry_filtervalue`.`id`, `sentry_filtervalue`.`project_id`, `sentry_filtervalue`.`key`, `sentry_filtervalue`.`value`, `sentry_filtervalue`.`data`, `sentry_filtervalue`.`times_seen`, `sentry_filtervalue`.`last_seen`, `sentry_filtervalue`.`first_seen` FROM `sentry_filtervalue` WHERE (`sentry_filtervalue`.`project_id` = 815 AND `sentry_filtervalue`.`value` = 'Chrome' AND `sentry_filtervalue`.`key` = 'browser.name' )", u'time': u'0.000' }, { u'sql': u"SELECT `sentry_filterkey`.`id`, `sentry_filterkey`.`project_id`, `sentry_filterkey`.`key`, `sentry_filterkey`.`values_seen`, `sentry_filterkey`.`label`, `sentry_filterkey`.`status` FROM `sentry_filterkey` WHERE (`sentry_filterkey`.`project_id` = 815 AND `sentry_filterkey`.`key` = 'browser' )", u'time': u'0.000' }, { u'sql': u"SELECT `sentry_filtervalue`.`id`, `sentry_filtervalue`.`project_id`, `sentry_filtervalue`.`key`, `sentry_filtervalue`.`value`, `sentry_filtervalue`.`data`, `sentry_filtervalue`.`times_seen`, `sentry_filtervalue`.`last_seen`, `sentry_filtervalue`.`first_seen` FROM `sentry_filtervalue` WHERE (`sentry_filtervalue`.`project_id` = 815 AND `sentry_filtervalue`.`value` = 'Chrome 28.0.1500' AND `sentry_filtervalue`.`key` = 'browser' )", u'time': u'0.000' }, { u'sql': u'SAVEPOINT `s47055674149248_x54`', u'time': u'0.000' }, { u'sql': u"INSERT INTO `sentry_eventtag` (`project_id`, `group_id`, `event_id`, `key_id`, `value_id`, `date_added`) VALUES (815, 592, 373, 43, 42, '2018-05-22 10:54:14'), (815, 592, 373, 44, 43, '2018-05-22 10:54:14'), (815, 592, 373, 45, 44, '2018-05-22 10:54:14'), (815, 592, 373, 46, 45, '2018-05-22 10:54:14'), (815, 592, 373, 47, 46, '2018-05-22 10:54:14'), (815, 592, 373, 48, 47, '2018-05-22 10:54:14')", u'time': u'0.000' }, { u'sql': u'RELEASE SAVEPOINT `s47055674149248_x54`', u'time': u'0.000' }, { u'sql': u"UPDATE `sentry_filtervalue` SET `times_seen` = `sentry_filtervalue`.`times_seen` + 1, `data` = NULL, `last_seen` = '2018-05-22 10:54:14' WHERE (`sentry_filtervalue`.`project_id` = 815 AND `sentry_filtervalue`.`value` = 'error' AND `sentry_filtervalue`.`key` = 'level' )", u'time': u'0.001' }, { u'sql': u"UPDATE `sentry_messagefiltervalue` SET `times_seen` = `sentry_messagefiltervalue`.`times_seen` + 1, `project_id` = 815, `last_seen` = '2018-05-22 10:54:14' WHERE (`sentry_messagefiltervalue`.`group_id` = 592 AND `sentry_messagefiltervalue`.`value` = 'error' AND `sentry_messagefiltervalue`.`key` = 'level' )", u'time': u'0.001' }, { u'sql': u"UPDATE `sentry_filtervalue` SET `times_seen` = `sentry_filtervalue`.`times_seen` + 1, `data` = NULL, `last_seen` = '2018-05-22 10:54:14' WHERE (`sentry_filtervalue`.`project_id` = 815 AND `sentry_filtervalue`.`value` = 'http://example.com' AND `sentry_filtervalue`.`key` = 'url' )", u'time': u'0.001' }, { u'sql': u"UPDATE `sentry_messagefiltervalue` SET `times_seen` = `sentry_messagefiltervalue`.`times_seen` + 1, `project_id` = 815, `last_seen` = '2018-05-22 10:54:14' WHERE (`sentry_messagefiltervalue`.`group_id` = 592 AND `sentry_messagefiltervalue`.`value` = 'http://example.com' AND `sentry_messagefiltervalue`.`key` = 'url' )", u'time': u'0.001' }, { u'sql': u"UPDATE `sentry_filtervalue` SET `times_seen` = `sentry_filtervalue`.`times_seen` + 1, `data` = NULL, `last_seen` = '2018-05-22 10:54:14' WHERE (`sentry_filtervalue`.`project_id` = 815 AND `sentry_filtervalue`.`value` = 'ip:127.0.0.1' AND `sentry_filtervalue`.`key` = 'sentry:user' )", u'time': u'0.001' }, { u'sql': u"UPDATE `sentry_messagefiltervalue` SET `times_seen` = `sentry_messagefiltervalue`.`times_seen` + 1, `project_id` = 815, `last_seen` = '2018-05-22 10:54:14' WHERE (`sentry_messagefiltervalue`.`group_id` = 592 AND `sentry_messagefiltervalue`.`value` = 'ip:127.0.0.1' AND `sentry_messagefiltervalue`.`key` = 'sentry:user' )", u'time': u'0.001' }, { u'sql': u"UPDATE `sentry_filtervalue` SET `times_seen` = `sentry_filtervalue`.`times_seen` + 1, `data` = NULL, `last_seen` = '2018-05-22 10:54:14' WHERE (`sentry_filtervalue`.`project_id` = 815 AND `sentry_filtervalue`.`value` = 'Windows 8' AND `sentry_filtervalue`.`key` = 'os.name' )", u'time': u'0.001' }, { u'sql': u"UPDATE `sentry_messagefiltervalue` SET `times_seen` = `sentry_messagefiltervalue`.`times_seen` + 1, `project_id` = 815, `last_seen` = '2018-05-22 10:54:14' WHERE (`sentry_messagefiltervalue`.`group_id` = 592 AND `sentry_messagefiltervalue`.`value` = 'Windows 8' AND `sentry_messagefiltervalue`.`key` = 'os.name' )", u'time': u'0.001' }, { u'sql': u"UPDATE `sentry_filtervalue` SET `times_seen` = `sentry_filtervalue`.`times_seen` + 1, `data` = NULL, `last_seen` = '2018-05-22 10:54:14' WHERE (`sentry_filtervalue`.`project_id` = 815 AND `sentry_filtervalue`.`value` = 'Chrome' AND `sentry_filtervalue`.`key` = 'browser.name' )", u'time': u'0.001' }, { u'sql': u"UPDATE `sentry_messagefiltervalue` SET `times_seen` = `sentry_messagefiltervalue`.`times_seen` + 1, `project_id` = 815, `last_seen` = '2018-05-22 10:54:14' WHERE (`sentry_messagefiltervalue`.`group_id` = 592 AND `sentry_messagefiltervalue`.`value` = 'Chrome' AND `sentry_messagefiltervalue`.`key` = 'browser.name' )", u'time': u'0.001' }, { u'sql': u"UPDATE `sentry_filtervalue` SET `times_seen` = `sentry_filtervalue`.`times_seen` + 1, `data` = NULL, `last_seen` = '2018-05-22 10:54:14' WHERE (`sentry_filtervalue`.`project_id` = 815 AND `sentry_filtervalue`.`value` = 'Chrome 28.0.1500' AND `sentry_filtervalue`.`key` = 'browser' )", u'time': u'0.001' }, { u'sql': u"UPDATE `sentry_messagefiltervalue` SET `times_seen` = `sentry_messagefiltervalue`.`times_seen` + 1, `project_id` = 815, `last_seen` = '2018-05-22 10:54:14' WHERE (`sentry_messagefiltervalue`.`group_id` = 592 AND `sentry_messagefiltervalue`.`value` = 'Chrome 28.0.1500' AND `sentry_messagefiltervalue`.`key` = 'browser' )", u'time': u'0.001' }, { u'sql': u'SELECT `sentry_groupedmessage`.`id`, `sentry_groupedmessage`.`project_id`, `sentry_groupedmessage`.`logger`, `sentry_groupedmessage`.`level`, `sentry_groupedmessage`.`message`, `sentry_groupedmessage`.`view`, `sentry_groupedmessage`.`num_comments`, `sentry_groupedmessage`.`platform`, `sentry_groupedmessage`.`status`, `sentry_groupedmessage`.`times_seen`, `sentry_groupedmessage`.`last_seen`, `sentry_groupedmessage`.`first_seen`, `sentry_groupedmessage`.`first_release_id`, `sentry_groupedmessage`.`resolved_at`, `sentry_groupedmessage`.`active_at`, `sentry_groupedmessage`.`time_spent_total`, `sentry_groupedmessage`.`time_spent_count`, `sentry_groupedmessage`.`score`, `sentry_groupedmessage`.`is_public`, `sentry_groupedmessage`.`data`, `sentry_groupedmessage`.`short_id` FROM `sentry_groupedmessage` WHERE `sentry_groupedmessage`.`id` = 592 ', u'time': u'0.001' }, { u'sql': u'SELECT `sentry_groupsnooze`.`id`, `sentry_groupsnooze`.`group_id`, `sentry_groupsnooze`.`until`, `sentry_groupsnooze`.`count`, `sentry_groupsnooze`.`window`, `sentry_groupsnooze`.`user_count`, `sentry_groupsnooze`.`user_window`, `sentry_groupsnooze`.`state`, `sentry_groupsnooze`.`actor_id` FROM `sentry_groupsnooze` WHERE `sentry_groupsnooze`.`group_id` = 592 ', u'time': u'0.000' }, { u'sql': u'SELECT `sentry_grouprulestatus`.`id`, `sentry_grouprulestatus`.`project_id`, `sentry_grouprulestatus`.`rule_id`, `sentry_grouprulestatus`.`group_id`, `sentry_grouprulestatus`.`status`, `sentry_grouprulestatus`.`date_added`, `sentry_grouprulestatus`.`last_active` FROM `sentry_grouprulestatus` WHERE (`sentry_grouprulestatus`.`group_id` = 592 AND `sentry_grouprulestatus`.`rule_id` = 827 )', u'time': u'0.001' }, { u'sql': u'SAVEPOINT `s47055674149248_x55`', u'time': u'0.000' }, { u'sql': u'RELEASE SAVEPOINT `s47055674149248_x55`', u'time': u'0.000' }]) assert result == { 'nodestore_node': 2, 'sentry_environmentproject': 1, 'sentry_eventtag': 1, 'sentry_eventuser': 1, 'sentry_filtervalue': 6, 'sentry_groupedmessage': 1, 'sentry_message': 1, 'sentry_messagefiltervalue': 6, 'sentry_userreport': 1 }
def test_parse_postgres_queries(self): result = parse_queries([ {u'sql': u'SAVEPOINT "s47890194282880_x49"', u'time': u'0.000'}, {u'sql': u'RELEASE SAVEPOINT "s47890194282880_x49"', u'time': u'0.000'}, {u'sql': u'SELECT "sentry_rawevent"."id", "sentry_rawevent"."project_id", "sentry_rawevent"."event_id", "sentry_rawevent"."datetime", "sentry_rawevent"."data" FROM "sentry_rawevent" WHERE ("sentry_rawevent"."event_id" = \'1fba9e314001443b93285dc4411f1593\' AND "sentry_rawevent"."project_id" = 864 )', u'time': u'0.000'}, {u'sql': u'SELECT "sentry_reprocessingreport"."id", "sentry_reprocessingreport"."project_id", "sentry_reprocessingreport"."event_id", "sentry_reprocessingreport"."datetime" FROM "sentry_reprocessingreport" WHERE ("sentry_reprocessingreport"."event_id" = \'1fba9e314001443b93285dc4411f1593\' AND "sentry_reprocessingreport"."project_id" = 864 )', u'time': u'0.001'}, {u'sql': u'SELECT "sentry_message"."id", "sentry_message"."group_id", "sentry_message"."message_id", "sentry_message"."project_id", "sentry_message"."message", "sentry_message"."platform", "sentry_message"."datetime", "sentry_message"."time_spent", "sentry_message"."data" FROM "sentry_message" WHERE ("sentry_message"."message_id" = \'1fba9e314001443b93285dc4411f1593\' AND "sentry_message"."project_id" = 864 )', u'time': u'0.001'}, {u'sql': u'SAVEPOINT "s47890194282880_x50"', u'time': u'0.000'}, {u'sql': u'INSERT INTO "sentry_eventuser" ("project_id", "hash", "ident", "email", "username", "name", "ip_address", "date_added") VALUES (864, \'f528764d624db129b32c21fbca0cb8d6\', NULL, NULL, NULL, NULL, \'127.0.0.1\', \'2018-05-22 09:12:12.357888+00:00\') RETURNING "sentry_eventuser"."id"', u'time': u'0.000'}, {u'sql': u'ROLLBACK TO SAVEPOINT "s47890194282880_x50"', u'time': u'0.000'}, {u'sql': u'SELECT "sentry_eventuser"."id", "sentry_eventuser"."project_id", "sentry_eventuser"."hash", "sentry_eventuser"."ident", "sentry_eventuser"."email", "sentry_eventuser"."username", "sentry_eventuser"."name", "sentry_eventuser"."ip_address", "sentry_eventuser"."date_added" FROM "sentry_eventuser" WHERE ("sentry_eventuser"."project_id" = 864 AND "sentry_eventuser"."hash" = \'f528764d624db129b32c21fbca0cb8d6\' )', u'time': u'0.000'}, {u'sql': u'SELECT "sentry_grouphash"."id", "sentry_grouphash"."project_id", "sentry_grouphash"."hash", "sentry_grouphash"."group_id", "sentry_grouphash"."group_tombstone_id", "sentry_grouphash"."state" FROM "sentry_grouphash" WHERE ("sentry_grouphash"."project_id" = 864 AND "sentry_grouphash"."hash" = \'5d41402abc4b2a76b9719d911017c592\' )', u'time': u'0.000'}, {u'sql': u'SELECT "sentry_groupedmessage"."id", "sentry_groupedmessage"."project_id", "sentry_groupedmessage"."logger", "sentry_groupedmessage"."level", "sentry_groupedmessage"."message", "sentry_groupedmessage"."view", "sentry_groupedmessage"."num_comments", "sentry_groupedmessage"."platform", "sentry_groupedmessage"."status", "sentry_groupedmessage"."times_seen", "sentry_groupedmessage"."last_seen", "sentry_groupedmessage"."first_seen", "sentry_groupedmessage"."first_release_id", "sentry_groupedmessage"."resolved_at", "sentry_groupedmessage"."active_at", "sentry_groupedmessage"."time_spent_total", "sentry_groupedmessage"."time_spent_count", "sentry_groupedmessage"."score", "sentry_groupedmessage"."is_public", "sentry_groupedmessage"."data", "sentry_groupedmessage"."short_id" FROM "sentry_groupedmessage" WHERE "sentry_groupedmessage"."id" = 662 ', u'time': u'0.000'}, {u'sql': u'SELECT "sentry_project"."id", "sentry_project"."slug", "sentry_project"."name", "sentry_project"."forced_color", "sentry_project"."organization_id", "sentry_project"."public", "sentry_project"."date_added", "sentry_project"."status", "sentry_project"."first_event", "sentry_project"."flags", "sentry_project"."platform" FROM "sentry_project" WHERE "sentry_project"."id" = 864 ', u'time': u'0.000'}, {u'sql': u'UPDATE "sentry_groupedmessage" SET "times_seen" = "sentry_groupedmessage"."times_seen" + 1, "score" = 1526980332, "data" = \'eJwVyksKhEAMRdF5NlKORKv89QbcgOBUgokopOlgRcHddxze905BWsMUBLMtJ6983EwBNMJYt7H7DFVKEfIU7FH2Pbkl3vAS82re58uGhIbeLRSknRM7TF7ew7yzyA90gJzLP+FOIA0=\', "last_seen" = \'2018-05-22 09:12:12+00:00\' WHERE "sentry_groupedmessage"."id" = 662 ', u'time': u'0.001'}, {u'sql': u'SAVEPOINT "s47890194282880_x51"', u'time': u'0.000'}, {u'sql': u'INSERT INTO "sentry_environmentproject" ("project_id", "environment_id", "is_hidden") VALUES (864, 165, NULL) RETURNING "sentry_environmentproject"."id"', u'time': u'0.000'}, {u'sql': u'ROLLBACK TO SAVEPOINT "s47890194282880_x51"', u'time': u'0.000'}, {u'sql': u'UPDATE "sentry_userreport" SET "environment_id" = 165, "group_id" = 662 WHERE ("sentry_userreport"."project_id" = 864 AND "sentry_userreport"."event_id" = \'1fba9e314001443b93285dc4411f1593\' )', u'time': u'0.000'}, {u'sql': u'SAVEPOINT "s47890194282880_x52"', u'time': u'0.000'}, {u'sql': u'UPDATE "nodestore_node" SET "timestamp" = \'2018-05-22 09:12:12.374085+00:00\', "data" = \'eJxtU8Fu2zAMvesrfIsLbI4lS7KTnYoBW4qu7SFdcgxUm3G0OLEgq127ov8+UnHTSxHACMn3KOo9Km0cZ8uJ8/0fqMOEOcGuKi3ZsJwMcAz+JbPHAH5rahiy3wN4hBQsbZxElnUb0zQehgGzChNclFmOP46xZsOnTW4QblpAREl9KqQdzqkZW+2g63rmeB758By8wQLnBOaCBtt42G6ewA+2P1KpYFfi84EXIThCyEimCR99RwmN52BtPp3Cszm4DrK6P2C+pD47MA12J1zF0s7xGX1FzlYkwNfLFs9BoTgzq5v+n+06M1VZnqRre2z6v0Nye5/oTHxL1ndrLS+SS4f91/BwbcNUFWVW6CS9Xtzf/PqSdHYPyU+o9/1F8n3n+wNMRUX6qTzPSpEszdZ4O7LwSMGMIVXqHu/4HGhEEd0QZEcfYxVjjfGHRKJkt0g7mgOJLEjz92ErSsyi1g8eEyeHc2pScNYiczk5z0QllLqNHU4DU6pAOvK39tiCdx4NoKwk1QoS/fU1aWBrHruQvL1RSTMz+khR+bFyzZ4SVTx9hsy6syj2xpKLMmetJtTHvSRnK9q3HP/GFRhvKAu22rh+CGsbdotoJyZlvKWHGuwTNART7AdXQs+qvCgiH7zvo/NS0/Qy7kMwbUzFZZC4DMtJB09Ai6RyNpIo4Cw4hR6l73umis/3TElCqog8be388aS8ws20bn5+SIQrI64fstPtVmfrqFjF4mjdiHAK39HJHnyHOcI0Lmvaoq1jOjlbSkUceWhJyyjvHl42luTR+LBmyCEJXhz11bRmo5UUKqodIJjGBHqlWpNzmnYm2NBFSsXa+Jaz/zqNSI8=\' WHERE "nodestore_node"."id" = \'u9iv1Ih4RDqz5GtlwX3+TA==\' ', u'time': u'0.000'}, {u'sql': u'SAVEPOINT "s47890194282880_x53"', u'time': u'0.000'}, {u'sql': u'INSERT INTO "nodestore_node" ("id", "data", "timestamp") VALUES (\'u9iv1Ih4RDqz5GtlwX3+TA==\', \'eJxtU8Fu2zAMvesrfIsLbI4lS7KTnYoBW4qu7SFdcgxUm3G0OLEgq127ov8+UnHTSxHACMn3KOo9Km0cZ8uJ8/0fqMOEOcGuKi3ZsJwMcAz+JbPHAH5rahiy3wN4hBQsbZxElnUb0zQehgGzChNclFmOP46xZsOnTW4QblpAREl9KqQdzqkZW+2g63rmeB758By8wQLnBOaCBtt42G6ewA+2P1KpYFfi84EXIThCyEimCR99RwmN52BtPp3Cszm4DrK6P2C+pD47MA12J1zF0s7xGX1FzlYkwNfLFs9BoTgzq5v+n+06M1VZnqRre2z6v0Nye5/oTHxL1ndrLS+SS4f91/BwbcNUFWVW6CS9Xtzf/PqSdHYPyU+o9/1F8n3n+wNMRUX6qTzPSpEszdZ4O7LwSMGMIVXqHu/4HGhEEd0QZEcfYxVjjfGHRKJkt0g7mgOJLEjz92ErSsyi1g8eEyeHc2pScNYiczk5z0QllLqNHU4DU6pAOvK39tiCdx4NoKwk1QoS/fU1aWBrHruQvL1RSTMz+khR+bFyzZ4SVTx9hsy6syj2xpKLMmetJtTHvSRnK9q3HP/GFRhvKAu22rh+CGsbdotoJyZlvKWHGuwTNART7AdXQs+qvCgiH7zvo/NS0/Qy7kMwbUzFZZC4DMtJB09Ai6RyNpIo4Cw4hR6l73umis/3TElCqog8be388aS8ws20bn5+SIQrI64fstPtVmfrqFjF4mjdiHAK39HJHnyHOcI0Lmvaoq1jOjlbSkUceWhJyyjvHl42luTR+LBmyCEJXhz11bRmo5UUKqodIJjGBHqlWpNzmnYm2NBFSsXa+Jaz/zqNSI8=\', \'2018-05-22 09:12:12.374085+00:00\')', u'time': u'0.000'}, {u'sql': u'RELEASE SAVEPOINT "s47890194282880_x53"', u'time': u'0.000'}, {u'sql': u'INSERT INTO "sentry_message" ("group_id", "message_id", "project_id", "message", "platform", "datetime", "time_spent", "data") VALUES (662, \'1fba9e314001443b93285dc4411f1593\', 864, \'hello http://example.com\', \'javascript\', \'2018-05-22 09:12:12+00:00\', NULL, \'eJzTSCkw5ApWz8tPSY3PTFHnKjAC8kotM8sMPTNMglwKq0zdS3LKI4y1QxxtbYHSxlzFegCZxA8W\') RETURNING "sentry_message"."id"', u'time': u'0.000'}, {u'sql': u'RELEASE SAVEPOINT "s47890194282880_x52"', u'time': u'0.000'}, {u'sql': u'SELECT "sentry_filterkey"."id", "sentry_filterkey"."project_id", "sentry_filterkey"."key", "sentry_filterkey"."values_seen", "sentry_filterkey"."label", "sentry_filterkey"."status" FROM "sentry_filterkey" WHERE ("sentry_filterkey"."project_id" = 864 AND "sentry_filterkey"."key" = \'level\' )', u'time': u'0.001'}, {u'sql': u'SELECT "sentry_filtervalue"."id", "sentry_filtervalue"."project_id", "sentry_filtervalue"."key", "sentry_filtervalue"."value", "sentry_filtervalue"."data", "sentry_filtervalue"."times_seen", "sentry_filtervalue"."last_seen", "sentry_filtervalue"."first_seen" FROM "sentry_filtervalue" WHERE ("sentry_filtervalue"."project_id" = 864 AND "sentry_filtervalue"."value" = \'error\' AND "sentry_filtervalue"."key" = \'level\' )', u'time': u'0.000'}, {u'sql': u'SELECT "sentry_filterkey"."id", "sentry_filterkey"."project_id", "sentry_filterkey"."key", "sentry_filterkey"."values_seen", "sentry_filterkey"."label", "sentry_filterkey"."status" FROM "sentry_filterkey" WHERE ("sentry_filterkey"."project_id" = 864 AND "sentry_filterkey"."key" = \'url\' )', u'time': u'0.001'}, {u'sql': u'SELECT "sentry_filtervalue"."id", "sentry_filtervalue"."project_id", "sentry_filtervalue"."key", "sentry_filtervalue"."value", "sentry_filtervalue"."data", "sentry_filtervalue"."times_seen", "sentry_filtervalue"."last_seen", "sentry_filtervalue"."first_seen" FROM "sentry_filtervalue" WHERE ("sentry_filtervalue"."project_id" = 864 AND "sentry_filtervalue"."value" = \'http://example.com\' AND "sentry_filtervalue"."key" = \'url\' )', u'time': u'0.000'}, {u'sql': u'SELECT "sentry_filterkey"."id", "sentry_filterkey"."project_id", "sentry_filterkey"."key", "sentry_filterkey"."values_seen", "sentry_filterkey"."label", "sentry_filterkey"."status" FROM "sentry_filterkey" WHERE ("sentry_filterkey"."project_id" = 864 AND "sentry_filterkey"."key" = \'sentry:user\' )', u'time': u'0.000'}, {u'sql': u'SELECT "sentry_filtervalue"."id", "sentry_filtervalue"."project_id", "sentry_filtervalue"."key", "sentry_filtervalue"."value", "sentry_filtervalue"."data", "sentry_filtervalue"."times_seen", "sentry_filtervalue"."last_seen", "sentry_filtervalue"."first_seen" FROM "sentry_filtervalue" WHERE ("sentry_filtervalue"."project_id" = 864 AND "sentry_filtervalue"."value" = \'ip:127.0.0.1\' AND "sentry_filtervalue"."key" = \'sentry:user\' )', u'time': u'0.000'}, {u'sql': u'SELECT "sentry_filterkey"."id", "sentry_filterkey"."project_id", "sentry_filterkey"."key", "sentry_filterkey"."values_seen", "sentry_filterkey"."label", "sentry_filterkey"."status" FROM "sentry_filterkey" WHERE ("sentry_filterkey"."project_id" = 864 AND "sentry_filterkey"."key" = \'os.name\' )', u'time': u'0.000'}, {u'sql': u'SELECT "sentry_filtervalue"."id", "sentry_filtervalue"."project_id", "sentry_filtervalue"."key", "sentry_filtervalue"."value", "sentry_filtervalue"."data", "sentry_filtervalue"."times_seen", "sentry_filtervalue"."last_seen", "sentry_filtervalue"."first_seen" FROM "sentry_filtervalue" WHERE ("sentry_filtervalue"."project_id" = 864 AND "sentry_filtervalue"."value" = \'Windows 8\' AND "sentry_filtervalue"."key" = \'os.name\' )', u'time': u'0.000'}, {u'sql': u'SELECT "sentry_filterkey"."id", "sentry_filterkey"."project_id", "sentry_filterkey"."key", "sentry_filterkey"."values_seen", "sentry_filterkey"."label", "sentry_filterkey"."status" FROM "sentry_filterkey" WHERE ("sentry_filterkey"."project_id" = 864 AND "sentry_filterkey"."key" = \'browser.name\' )', u'time': u'0.000'}, {u'sql': u'SELECT "sentry_filtervalue"."id", "sentry_filtervalue"."project_id", "sentry_filtervalue"."key", "sentry_filtervalue"."value", "sentry_filtervalue"."data", "sentry_filtervalue"."times_seen", "sentry_filtervalue"."last_seen", "sentry_filtervalue"."first_seen" FROM "sentry_filtervalue" WHERE ("sentry_filtervalue"."project_id" = 864 AND "sentry_filtervalue"."value" = \'Chrome\' AND "sentry_filtervalue"."key" = \'browser.name\' )', u'time': u'0.000'}, {u'sql': u'SELECT "sentry_filterkey"."id", "sentry_filterkey"."project_id", "sentry_filterkey"."key", "sentry_filterkey"."values_seen", "sentry_filterkey"."label", "sentry_filterkey"."status" FROM "sentry_filterkey" WHERE ("sentry_filterkey"."project_id" = 864 AND "sentry_filterkey"."key" = \'browser\' )', u'time': u'0.000'}, {u'sql': u'SELECT "sentry_filtervalue"."id", "sentry_filtervalue"."project_id", "sentry_filtervalue"."key", "sentry_filtervalue"."value", "sentry_filtervalue"."data", "sentry_filtervalue"."times_seen", "sentry_filtervalue"."last_seen", "sentry_filtervalue"."first_seen" FROM "sentry_filtervalue" WHERE ("sentry_filtervalue"."project_id" = 864 AND "sentry_filtervalue"."value" = \'Chrome 28.0.1500\' AND "sentry_filtervalue"."key" = \'browser\' )', u'time': u'0.000'}, {u'sql': u'SAVEPOINT "s47890194282880_x54"', u'time': u'0.000'}, {u'sql': u'INSERT INTO "sentry_eventtag" ("project_id", "group_id", "event_id", "key_id", "value_id", "date_added") VALUES (864, 662, 454, 108, 108, \'2018-05-22 09:12:12+00:00\'), (864, 662, 454, 109, 109, \'2018-05-22 09:12:12+00:00\'), (864, 662, 454, 110, 110, \'2018-05-22 09:12:12+00:00\'), (864, 662, 454, 111, 111, \'2018-05-22 09:12:12+00:00\'), (864, 662, 454, 112, 112, \'2018-05-22 09:12:12+00:00\'), (864, 662, 454, 113, 113, \'2018-05-22 09:12:12+00:00\')', u'time': u'0.000'}, {u'sql': u'RELEASE SAVEPOINT "s47890194282880_x54"', u'time': u'0.000'}, {u'sql': u'UPDATE "sentry_filtervalue" SET "times_seen" = "sentry_filtervalue"."times_seen" + 1, "data" = NULL, "last_seen" = \'2018-05-22 09:12:12+00:00\' WHERE ("sentry_filtervalue"."project_id" = 864 AND "sentry_filtervalue"."value" = \'error\' AND "sentry_filtervalue"."key" = \'level\' )', u'time': u'0.001'}, {u'sql': u'UPDATE "sentry_messagefiltervalue" SET "times_seen" = "sentry_messagefiltervalue"."times_seen" + 1, "project_id" = 864, "last_seen" = \'2018-05-22 09:12:12+00:00\' WHERE ("sentry_messagefiltervalue"."group_id" = 662 AND "sentry_messagefiltervalue"."value" = \'error\' AND "sentry_messagefiltervalue"."key" = \'level\' )', u'time': u'0.000'}, {u'sql': u'UPDATE "sentry_filtervalue" SET "times_seen" = "sentry_filtervalue"."times_seen" + 1, "data" = NULL, "last_seen" = \'2018-05-22 09:12:12+00:00\' WHERE ("sentry_filtervalue"."project_id" = 864 AND "sentry_filtervalue"."value" = \'http://example.com\' AND "sentry_filtervalue"."key" = \'url\' )', u'time': u'0.001'}, {u'sql': u'UPDATE "sentry_messagefiltervalue" SET "times_seen" = "sentry_messagefiltervalue"."times_seen" + 1, "project_id" = 864, "last_seen" = \'2018-05-22 09:12:12+00:00\' WHERE ("sentry_messagefiltervalue"."group_id" = 662 AND "sentry_messagefiltervalue"."value" = \'http://example.com\' AND "sentry_messagefiltervalue"."key" = \'url\' )', u'time': u'0.001'}, {u'sql': u'UPDATE "sentry_filtervalue" SET "times_seen" = "sentry_filtervalue"."times_seen" + 1, "data" = NULL, "last_seen" = \'2018-05-22 09:12:12+00:00\' WHERE ("sentry_filtervalue"."project_id" = 864 AND "sentry_filtervalue"."value" = \'ip:127.0.0.1\' AND "sentry_filtervalue"."key" = \'sentry:user\' )', u'time': u'0.001'}, {u'sql': u'UPDATE "sentry_messagefiltervalue" SET "times_seen" = "sentry_messagefiltervalue"."times_seen" + 1, "project_id" = 864, "last_seen" = \'2018-05-22 09:12:12+00:00\' WHERE ("sentry_messagefiltervalue"."group_id" = 662 AND "sentry_messagefiltervalue"."value" = \'ip:127.0.0.1\' AND "sentry_messagefiltervalue"."key" = \'sentry:user\' )', u'time': u'0.001'}, {u'sql': u'UPDATE "sentry_filtervalue" SET "times_seen" = "sentry_filtervalue"."times_seen" + 1, "data" = NULL, "last_seen" = \'2018-05-22 09:12:12+00:00\' WHERE ("sentry_filtervalue"."project_id" = 864 AND "sentry_filtervalue"."value" = \'Windows 8\' AND "sentry_filtervalue"."key" = \'os.name\' )', u'time': u'0.001'}, {u'sql': u'UPDATE "sentry_messagefiltervalue" SET "times_seen" = "sentry_messagefiltervalue"."times_seen" + 1, "project_id" = 864, "last_seen" = \'2018-05-22 09:12:12+00:00\' WHERE ("sentry_messagefiltervalue"."group_id" = 662 AND "sentry_messagefiltervalue"."value" = \'Windows 8\' AND "sentry_messagefiltervalue"."key" = \'os.name\' )', u'time': u'0.001'}, {u'sql': u'UPDATE "sentry_filtervalue" SET "times_seen" = "sentry_filtervalue"."times_seen" + 1, "data" = NULL, "last_seen" = \'2018-05-22 09:12:12+00:00\' WHERE ("sentry_filtervalue"."project_id" = 864 AND "sentry_filtervalue"."value" = \'Chrome\' AND "sentry_filtervalue"."key" = \'browser.name\' )', u'time': u'0.001'}, {u'sql': u'UPDATE "sentry_messagefiltervalue" SET "times_seen" = "sentry_messagefiltervalue"."times_seen" + 1, "project_id" = 864, "last_seen" = \'2018-05-22 09:12:12+00:00\' WHERE ("sentry_messagefiltervalue"."group_id" = 662 AND "sentry_messagefiltervalue"."value" = \'Chrome\' AND "sentry_messagefiltervalue"."key" = \'browser.name\' )', u'time': u'0.001'}, {u'sql': u'UPDATE "sentry_filtervalue" SET "times_seen" = "sentry_filtervalue"."times_seen" + 1, "data" = NULL, "last_seen" = \'2018-05-22 09:12:12+00:00\' WHERE ("sentry_filtervalue"."project_id" = 864 AND "sentry_filtervalue"."value" = \'Chrome 28.0.1500\' AND "sentry_filtervalue"."key" = \'browser\' )', u'time': u'0.001'}, {u'sql': u'UPDATE "sentry_messagefiltervalue" SET "times_seen" = "sentry_messagefiltervalue"."times_seen" + 1, "project_id" = 864, "last_seen" = \'2018-05-22 09:12:12+00:00\' WHERE ("sentry_messagefiltervalue"."group_id" = 662 AND "sentry_messagefiltervalue"."value" = \'Chrome 28.0.1500\' AND "sentry_messagefiltervalue"."key" = \'browser\' )', u'time': u'0.001'}, {u'sql': u'SELECT "sentry_groupedmessage"."id", "sentry_groupedmessage"."project_id", "sentry_groupedmessage"."logger", "sentry_groupedmessage"."level", "sentry_groupedmessage"."message", "sentry_groupedmessage"."view", "sentry_groupedmessage"."num_comments", "sentry_groupedmessage"."platform", "sentry_groupedmessage"."status", "sentry_groupedmessage"."times_seen", "sentry_groupedmessage"."last_seen", "sentry_groupedmessage"."first_seen", "sentry_groupedmessage"."first_release_id", "sentry_groupedmessage"."resolved_at", "sentry_groupedmessage"."active_at", "sentry_groupedmessage"."time_spent_total", "sentry_groupedmessage"."time_spent_count", "sentry_groupedmessage"."score", "sentry_groupedmessage"."is_public", "sentry_groupedmessage"."data", "sentry_groupedmessage"."short_id" FROM "sentry_groupedmessage" WHERE "sentry_groupedmessage"."id" = 662 ', u'time': u'0.001'}, {u'sql': u'SELECT "sentry_groupsnooze"."id", "sentry_groupsnooze"."group_id", "sentry_groupsnooze"."until", "sentry_groupsnooze"."count", "sentry_groupsnooze"."window", "sentry_groupsnooze"."user_count", "sentry_groupsnooze"."user_window", "sentry_groupsnooze"."state", "sentry_groupsnooze"."actor_id" FROM "sentry_groupsnooze" WHERE "sentry_groupsnooze"."group_id" = 662 ', u'time': u'0.000'}, {u'sql': u'SELECT "sentry_grouprulestatus"."id", "sentry_grouprulestatus"."project_id", "sentry_grouprulestatus"."rule_id", "sentry_grouprulestatus"."group_id", "sentry_grouprulestatus"."status", "sentry_grouprulestatus"."date_added", "sentry_grouprulestatus"."last_active" FROM "sentry_grouprulestatus" WHERE ("sentry_grouprulestatus"."group_id" = 662 AND "sentry_grouprulestatus"."rule_id" = 935 )', u'time': u'0.000'}, {u'sql': u'SAVEPOINT "s47890194282880_x55"', u'time': u'0.000'}, {u'sql': u'RELEASE SAVEPOINT "s47890194282880_x55"', u'time': u'0.000'}] ) assert result == { 'nodestore_node': 2, 'sentry_environmentproject': 1, 'sentry_eventtag': 1, 'sentry_eventuser': 1, 'sentry_filtervalue': 6, 'sentry_groupedmessage': 1, 'sentry_message': 1, 'sentry_messagefiltervalue': 6, 'sentry_userreport': 1 }
def test_parse_mysql_queries(self): result = parse_queries( [{u'sql': u'SAVEPOINT `s47055674149248_x49`', u'time': u'0.000'}, {u'sql': u'RELEASE SAVEPOINT `s47055674149248_x49`', u'time': u'0.000'}, {u'sql': u"SELECT `sentry_rawevent`.`id`, `sentry_rawevent`.`project_id`, `sentry_rawevent`.`event_id`, `sentry_rawevent`.`datetime`, `sentry_rawevent`.`data` FROM `sentry_rawevent` WHERE (`sentry_rawevent`.`event_id` = '1fa6e7d1c2674273be07852952e1bafc' AND `sentry_rawevent`.`project_id` = 815 )", u'time': u'0.000'}, {u'sql': u"SELECT `sentry_reprocessingreport`.`id`, `sentry_reprocessingreport`.`project_id`, `sentry_reprocessingreport`.`event_id`, `sentry_reprocessingreport`.`datetime` FROM `sentry_reprocessingreport` WHERE (`sentry_reprocessingreport`.`event_id` = '1fa6e7d1c2674273be07852952e1bafc' AND `sentry_reprocessingreport`.`project_id` = 815 )", u'time': u'0.000'}, {u'sql': u"SELECT `sentry_message`.`id`, `sentry_message`.`group_id`, `sentry_message`.`message_id`, `sentry_message`.`project_id`, `sentry_message`.`message`, `sentry_message`.`platform`, `sentry_message`.`datetime`, `sentry_message`.`time_spent`, `sentry_message`.`data` FROM `sentry_message` WHERE (`sentry_message`.`message_id` = '1fa6e7d1c2674273be07852952e1bafc' AND `sentry_message`.`project_id` = 815 )", u'time': u'0.000'}, {u'sql': u'SAVEPOINT `s47055674149248_x50`', u'time': u'0.000'}, {u'sql': u"INSERT INTO `sentry_eventuser` (`project_id`, `hash`, `ident`, `email`, `username`, `name`, `ip_address`, `date_added`) VALUES (815, 'f528764d624db129b32c21fbca0cb8d6', NULL, NULL, NULL, NULL, '127.0.0.1', '2018-05-22 10:54:14')", u'time': u'0.000'}, {u'sql': u'ROLLBACK TO SAVEPOINT `s47055674149248_x50`', u'time': u'0.000'}, {u'sql': u"SELECT `sentry_eventuser`.`id`, `sentry_eventuser`.`project_id`, `sentry_eventuser`.`hash`, `sentry_eventuser`.`ident`, `sentry_eventuser`.`email`, `sentry_eventuser`.`username`, `sentry_eventuser`.`name`, `sentry_eventuser`.`ip_address`, `sentry_eventuser`.`date_added` FROM `sentry_eventuser` WHERE (`sentry_eventuser`.`project_id` = 815 AND `sentry_eventuser`.`hash` = 'f528764d624db129b32c21fbca0cb8d6' )", u'time': u'0.000'}, {u'sql': u"SELECT `sentry_grouphash`.`id`, `sentry_grouphash`.`project_id`, `sentry_grouphash`.`hash`, `sentry_grouphash`.`group_id`, `sentry_grouphash`.`group_tombstone_id`, `sentry_grouphash`.`state` FROM `sentry_grouphash` WHERE (`sentry_grouphash`.`project_id` = 815 AND `sentry_grouphash`.`hash` = '5d41402abc4b2a76b9719d911017c592' )", u'time': u'0.000'}, {u'sql': u'SELECT `sentry_groupedmessage`.`id`, `sentry_groupedmessage`.`project_id`, `sentry_groupedmessage`.`logger`, `sentry_groupedmessage`.`level`, `sentry_groupedmessage`.`message`, `sentry_groupedmessage`.`view`, `sentry_groupedmessage`.`num_comments`, `sentry_groupedmessage`.`platform`, `sentry_groupedmessage`.`status`, `sentry_groupedmessage`.`times_seen`, `sentry_groupedmessage`.`last_seen`, `sentry_groupedmessage`.`first_seen`, `sentry_groupedmessage`.`first_release_id`, `sentry_groupedmessage`.`resolved_at`, `sentry_groupedmessage`.`active_at`, `sentry_groupedmessage`.`time_spent_total`, `sentry_groupedmessage`.`time_spent_count`, `sentry_groupedmessage`.`score`, `sentry_groupedmessage`.`is_public`, `sentry_groupedmessage`.`data`, `sentry_groupedmessage`.`short_id` FROM `sentry_groupedmessage` WHERE `sentry_groupedmessage`.`id` = 592 ', u'time': u'0.001'}, {u'sql': u'SELECT `sentry_project`.`id`, `sentry_project`.`slug`, `sentry_project`.`name`, `sentry_project`.`forced_color`, `sentry_project`.`organization_id`, `sentry_project`.`public`, `sentry_project`.`date_added`, `sentry_project`.`status`, `sentry_project`.`first_event`, `sentry_project`.`flags`, `sentry_project`.`platform` FROM `sentry_project` WHERE `sentry_project`.`id` = 815 ', u'time': u'0.000'}, {u'sql': u"UPDATE `sentry_groupedmessage` SET `times_seen` = `sentry_groupedmessage`.`times_seen` + 1, `score` = log(times_seen) * 600 + unix_timestamp(last_seen), `data` = 'eJwdyk0Kg0AMhuF9LjKuBH9mHC/gBQS3JZgUB1IanCj09k27fL/vaUg7WINgtcfJO5ebKYD2sHSxT3NOYxyhrsE+yr4PbomfeIl5/Z8XGxIaekdoSJMTKyY/PsF2sMgbNEOt7RfkkiAY', `last_seen` = '2018-05-22 10:54:14' WHERE `sentry_groupedmessage`.`id` = 592 ", u'time': u'0.000'}, {u'sql': u'SAVEPOINT `s47055674149248_x51`', u'time': u'0.000'}, {u'sql': u'INSERT INTO `sentry_environmentproject` (`project_id`, `environment_id`, `is_hidden`) VALUES (815, 96, NULL)', u'time': u'0.000'}, {u'sql': u'ROLLBACK TO SAVEPOINT `s47055674149248_x51`', u'time': u'0.000'}, {u'sql': u"UPDATE `sentry_userreport` SET `environment_id` = 96, `group_id` = 592 WHERE (`sentry_userreport`.`project_id` = 815 AND `sentry_userreport`.`event_id` = '1fa6e7d1c2674273be07852952e1bafc' )", u'time': u'0.000'}, {u'sql': u'SAVEPOINT `s47055674149248_x52`', u'time': u'0.000'}, {u'sql': u"UPDATE `nodestore_node` SET `timestamp` = '2018-05-22 10:54:14', `data` = 'eJxtU01v2zAMvetX6BYX2BxLtmSnOxUDtgz92CFdcgxUm3G0OLEgK127ov99pOKmOxQBjJB8pKj3npLGCbaYON//hjpMmJPsphLqhg2LyQCH4J9TewjgN6aGIf01gEdMzpLGFdhm3do0jYdhwKzChJBlmuFPYKzZ8OGQW4SbFhBR0pwK2/bn1Iwtt9B1PXMii/3wFLzBghAEFpIWW3vYrB/BD7Y/UClnP+THC89DcIQoYjNtePQdJTSeg7XL6RSezN51kNb9HvMlzdmCaXA64SqWdE7M6CsztiQCPl+1eA4yJZhZ3vZ/bdeZqUoznqzsoen/DPzunutUfuGrnytdXPArh/NX8HBtw1TlZZprnlzP729vPvHO7oB/h3rXX/CvW9/vYSor4k9lWVpKvjAb4+3YhUdKZgyxUvd4x6dAK8qohiQ5+hirGGuM3ymSJbvDtoPZE8mSOH9btqLELHL94DFxUjijIblgLXYuJuedqIRUt3HCaWFK5diO/Rt7aME7jwJQtiDWciL95YU3sDHHLvDXVyppZkYdKSr/81yzo0wVj59ha91ZZHttScYiY60m1PvFCsGWZLgM/0YPjFcscrZcu34IKxu286gnJot4TQ812EdoCKbYN6GknlW6UAX1g/d9lL7QtH4RDRFMG1PRDQW6YTHp4BHISSpjYxMFggWnUKTkzWgq/9hoeBgiVUSebHt5PFGv0JrWXZ5fEuHKiOuH9HS75Vk7KlaxOGo3IpzCh3TSBx9ihjCNbk1a1HVM87OmVMSVh5a4jPTu4HltiR6dozJSRmXCs6PBmow2ikmhotoegmlMoHeqNUmnyTXBhi62VKyNrzn9By1kSX8=' WHERE `nodestore_node`.`id` = '9cwO83agTCqM5QNjewZF+g==' ", u'time': u'0.000'}, {u'sql': u'SAVEPOINT `s47055674149248_x53`', u'time': u'0.000'}, {u'sql': u"INSERT INTO `nodestore_node` (`id`, `data`, `timestamp`) VALUES ('9cwO83agTCqM5QNjewZF+g==', 'eJxtU01v2zAMvetX6BYX2BxLtmSnOxUDtgz92CFdcgxUm3G0OLEgK127ov99pOKmOxQBjJB8pKj3npLGCbaYON//hjpMmJPsphLqhg2LyQCH4J9TewjgN6aGIf01gEdMzpLGFdhm3do0jYdhwKzChJBlmuFPYKzZ8OGQW4SbFhBR0pwK2/bn1Iwtt9B1PXMii/3wFLzBghAEFpIWW3vYrB/BD7Y/UClnP+THC89DcIQoYjNtePQdJTSeg7XL6RSezN51kNb9HvMlzdmCaXA64SqWdE7M6CsztiQCPl+1eA4yJZhZ3vZ/bdeZqUoznqzsoen/DPzunutUfuGrnytdXPArh/NX8HBtw1TlZZprnlzP729vPvHO7oB/h3rXX/CvW9/vYSor4k9lWVpKvjAb4+3YhUdKZgyxUvd4x6dAK8qohiQ5+hirGGuM3ymSJbvDtoPZE8mSOH9btqLELHL94DFxUjijIblgLXYuJuedqIRUt3HCaWFK5diO/Rt7aME7jwJQtiDWciL95YU3sDHHLvDXVyppZkYdKSr/81yzo0wVj59ha91ZZHttScYiY60m1PvFCsGWZLgM/0YPjFcscrZcu34IKxu286gnJot4TQ812EdoCKbYN6GknlW6UAX1g/d9lL7QtH4RDRFMG1PRDQW6YTHp4BHISSpjYxMFggWnUKTkzWgq/9hoeBgiVUSebHt5PFGv0JrWXZ5fEuHKiOuH9HS75Vk7KlaxOGo3IpzCh3TSBx9ihjCNbk1a1HVM87OmVMSVh5a4jPTu4HltiR6dozJSRmXCs6PBmow2ikmhotoegmlMoHeqNUmnyTXBhi62VKyNrzn9By1kSX8=', '2018-05-22 10:54:14')", u'time': u'0.000'}, {u'sql': u'RELEASE SAVEPOINT `s47055674149248_x53`', u'time': u'0.000'}, {u'sql': u"INSERT INTO `sentry_message` (`group_id`, `message_id`, `project_id`, `message`, `platform`, `datetime`, `time_spent`, `data`) VALUES (592, '1fa6e7d1c2674273be07852952e1bafc', 815, 'hello http://example.com', 'javascript', '2018-05-22 10:54:14', NULL, 'eJzTSCkw5ApWz8tPSY3PTFHnKjAC8iyTy/0tjBPTQ5wLfU0D/bJSy6PctNNtbYHSxlzFegCVlg8K')", u'time': u'0.000'}, {u'sql': u'RELEASE SAVEPOINT `s47055674149248_x52`', u'time': u'0.000'}, {u'sql': u"SELECT `sentry_filterkey`.`id`, `sentry_filterkey`.`project_id`, `sentry_filterkey`.`key`, `sentry_filterkey`.`values_seen`, `sentry_filterkey`.`label`, `sentry_filterkey`.`status` FROM `sentry_filterkey` WHERE (`sentry_filterkey`.`project_id` = 815 AND `sentry_filterkey`.`key` = 'level' )", u'time': u'0.001'}, {u'sql': u"SELECT `sentry_filtervalue`.`id`, `sentry_filtervalue`.`project_id`, `sentry_filtervalue`.`key`, `sentry_filtervalue`.`value`, `sentry_filtervalue`.`data`, `sentry_filtervalue`.`times_seen`, `sentry_filtervalue`.`last_seen`, `sentry_filtervalue`.`first_seen` FROM `sentry_filtervalue` WHERE (`sentry_filtervalue`.`project_id` = 815 AND `sentry_filtervalue`.`value` = 'error' AND `sentry_filtervalue`.`key` = 'level' )", u'time': u'0.000'}, {u'sql': u"SELECT `sentry_filterkey`.`id`, `sentry_filterkey`.`project_id`, `sentry_filterkey`.`key`, `sentry_filterkey`.`values_seen`, `sentry_filterkey`.`label`, `sentry_filterkey`.`status` FROM `sentry_filterkey` WHERE (`sentry_filterkey`.`project_id` = 815 AND `sentry_filterkey`.`key` = 'url' )", u'time': u'0.000'}, {u'sql': u"SELECT `sentry_filtervalue`.`id`, `sentry_filtervalue`.`project_id`, `sentry_filtervalue`.`key`, `sentry_filtervalue`.`value`, `sentry_filtervalue`.`data`, `sentry_filtervalue`.`times_seen`, `sentry_filtervalue`.`last_seen`, `sentry_filtervalue`.`first_seen` FROM `sentry_filtervalue` WHERE (`sentry_filtervalue`.`project_id` = 815 AND `sentry_filtervalue`.`value` = 'http://example.com' AND `sentry_filtervalue`.`key` = 'url' )", u'time': u'0.000'}, {u'sql': u"SELECT `sentry_filterkey`.`id`, `sentry_filterkey`.`project_id`, `sentry_filterkey`.`key`, `sentry_filterkey`.`values_seen`, `sentry_filterkey`.`label`, `sentry_filterkey`.`status` FROM `sentry_filterkey` WHERE (`sentry_filterkey`.`project_id` = 815 AND `sentry_filterkey`.`key` = 'sentry:user' )", u'time': u'0.000'}, {u'sql': u"SELECT `sentry_filtervalue`.`id`, `sentry_filtervalue`.`project_id`, `sentry_filtervalue`.`key`, `sentry_filtervalue`.`value`, `sentry_filtervalue`.`data`, `sentry_filtervalue`.`times_seen`, `sentry_filtervalue`.`last_seen`, `sentry_filtervalue`.`first_seen` FROM `sentry_filtervalue` WHERE (`sentry_filtervalue`.`project_id` = 815 AND `sentry_filtervalue`.`value` = 'ip:127.0.0.1' AND `sentry_filtervalue`.`key` = 'sentry:user' )", u'time': u'0.000'}, {u'sql': u"SELECT `sentry_filterkey`.`id`, `sentry_filterkey`.`project_id`, `sentry_filterkey`.`key`, `sentry_filterkey`.`values_seen`, `sentry_filterkey`.`label`, `sentry_filterkey`.`status` FROM `sentry_filterkey` WHERE (`sentry_filterkey`.`project_id` = 815 AND `sentry_filterkey`.`key` = 'os.name' )", u'time': u'0.000'}, {u'sql': u"SELECT `sentry_filtervalue`.`id`, `sentry_filtervalue`.`project_id`, `sentry_filtervalue`.`key`, `sentry_filtervalue`.`value`, `sentry_filtervalue`.`data`, `sentry_filtervalue`.`times_seen`, `sentry_filtervalue`.`last_seen`, `sentry_filtervalue`.`first_seen` FROM `sentry_filtervalue` WHERE (`sentry_filtervalue`.`project_id` = 815 AND `sentry_filtervalue`.`value` = 'Windows 8' AND `sentry_filtervalue`.`key` = 'os.name' )", u'time': u'0.000'}, {u'sql': u"SELECT `sentry_filterkey`.`id`, `sentry_filterkey`.`project_id`, `sentry_filterkey`.`key`, `sentry_filterkey`.`values_seen`, `sentry_filterkey`.`label`, `sentry_filterkey`.`status` FROM `sentry_filterkey` WHERE (`sentry_filterkey`.`project_id` = 815 AND `sentry_filterkey`.`key` = 'browser.name' )", u'time': u'0.000'}, {u'sql': u"SELECT `sentry_filtervalue`.`id`, `sentry_filtervalue`.`project_id`, `sentry_filtervalue`.`key`, `sentry_filtervalue`.`value`, `sentry_filtervalue`.`data`, `sentry_filtervalue`.`times_seen`, `sentry_filtervalue`.`last_seen`, `sentry_filtervalue`.`first_seen` FROM `sentry_filtervalue` WHERE (`sentry_filtervalue`.`project_id` = 815 AND `sentry_filtervalue`.`value` = 'Chrome' AND `sentry_filtervalue`.`key` = 'browser.name' )", u'time': u'0.000'}, {u'sql': u"SELECT `sentry_filterkey`.`id`, `sentry_filterkey`.`project_id`, `sentry_filterkey`.`key`, `sentry_filterkey`.`values_seen`, `sentry_filterkey`.`label`, `sentry_filterkey`.`status` FROM `sentry_filterkey` WHERE (`sentry_filterkey`.`project_id` = 815 AND `sentry_filterkey`.`key` = 'browser' )", u'time': u'0.000'}, {u'sql': u"SELECT `sentry_filtervalue`.`id`, `sentry_filtervalue`.`project_id`, `sentry_filtervalue`.`key`, `sentry_filtervalue`.`value`, `sentry_filtervalue`.`data`, `sentry_filtervalue`.`times_seen`, `sentry_filtervalue`.`last_seen`, `sentry_filtervalue`.`first_seen` FROM `sentry_filtervalue` WHERE (`sentry_filtervalue`.`project_id` = 815 AND `sentry_filtervalue`.`value` = 'Chrome 28.0.1500' AND `sentry_filtervalue`.`key` = 'browser' )", u'time': u'0.000'}, {u'sql': u'SAVEPOINT `s47055674149248_x54`', u'time': u'0.000'}, {u'sql': u"INSERT INTO `sentry_eventtag` (`project_id`, `group_id`, `event_id`, `key_id`, `value_id`, `date_added`) VALUES (815, 592, 373, 43, 42, '2018-05-22 10:54:14'), (815, 592, 373, 44, 43, '2018-05-22 10:54:14'), (815, 592, 373, 45, 44, '2018-05-22 10:54:14'), (815, 592, 373, 46, 45, '2018-05-22 10:54:14'), (815, 592, 373, 47, 46, '2018-05-22 10:54:14'), (815, 592, 373, 48, 47, '2018-05-22 10:54:14')", u'time': u'0.000'}, {u'sql': u'RELEASE SAVEPOINT `s47055674149248_x54`', u'time': u'0.000'}, {u'sql': u"UPDATE `sentry_filtervalue` SET `times_seen` = `sentry_filtervalue`.`times_seen` + 1, `data` = NULL, `last_seen` = '2018-05-22 10:54:14' WHERE (`sentry_filtervalue`.`project_id` = 815 AND `sentry_filtervalue`.`value` = 'error' AND `sentry_filtervalue`.`key` = 'level' )", u'time': u'0.001'}, {u'sql': u"UPDATE `sentry_messagefiltervalue` SET `times_seen` = `sentry_messagefiltervalue`.`times_seen` + 1, `project_id` = 815, `last_seen` = '2018-05-22 10:54:14' WHERE (`sentry_messagefiltervalue`.`group_id` = 592 AND `sentry_messagefiltervalue`.`value` = 'error' AND `sentry_messagefiltervalue`.`key` = 'level' )", u'time': u'0.001'}, {u'sql': u"UPDATE `sentry_filtervalue` SET `times_seen` = `sentry_filtervalue`.`times_seen` + 1, `data` = NULL, `last_seen` = '2018-05-22 10:54:14' WHERE (`sentry_filtervalue`.`project_id` = 815 AND `sentry_filtervalue`.`value` = 'http://example.com' AND `sentry_filtervalue`.`key` = 'url' )", u'time': u'0.001'}, {u'sql': u"UPDATE `sentry_messagefiltervalue` SET `times_seen` = `sentry_messagefiltervalue`.`times_seen` + 1, `project_id` = 815, `last_seen` = '2018-05-22 10:54:14' WHERE (`sentry_messagefiltervalue`.`group_id` = 592 AND `sentry_messagefiltervalue`.`value` = 'http://example.com' AND `sentry_messagefiltervalue`.`key` = 'url' )", u'time': u'0.001'}, {u'sql': u"UPDATE `sentry_filtervalue` SET `times_seen` = `sentry_filtervalue`.`times_seen` + 1, `data` = NULL, `last_seen` = '2018-05-22 10:54:14' WHERE (`sentry_filtervalue`.`project_id` = 815 AND `sentry_filtervalue`.`value` = 'ip:127.0.0.1' AND `sentry_filtervalue`.`key` = 'sentry:user' )", u'time': u'0.001'}, {u'sql': u"UPDATE `sentry_messagefiltervalue` SET `times_seen` = `sentry_messagefiltervalue`.`times_seen` + 1, `project_id` = 815, `last_seen` = '2018-05-22 10:54:14' WHERE (`sentry_messagefiltervalue`.`group_id` = 592 AND `sentry_messagefiltervalue`.`value` = 'ip:127.0.0.1' AND `sentry_messagefiltervalue`.`key` = 'sentry:user' )", u'time': u'0.001'}, {u'sql': u"UPDATE `sentry_filtervalue` SET `times_seen` = `sentry_filtervalue`.`times_seen` + 1, `data` = NULL, `last_seen` = '2018-05-22 10:54:14' WHERE (`sentry_filtervalue`.`project_id` = 815 AND `sentry_filtervalue`.`value` = 'Windows 8' AND `sentry_filtervalue`.`key` = 'os.name' )", u'time': u'0.001'}, {u'sql': u"UPDATE `sentry_messagefiltervalue` SET `times_seen` = `sentry_messagefiltervalue`.`times_seen` + 1, `project_id` = 815, `last_seen` = '2018-05-22 10:54:14' WHERE (`sentry_messagefiltervalue`.`group_id` = 592 AND `sentry_messagefiltervalue`.`value` = 'Windows 8' AND `sentry_messagefiltervalue`.`key` = 'os.name' )", u'time': u'0.001'}, {u'sql': u"UPDATE `sentry_filtervalue` SET `times_seen` = `sentry_filtervalue`.`times_seen` + 1, `data` = NULL, `last_seen` = '2018-05-22 10:54:14' WHERE (`sentry_filtervalue`.`project_id` = 815 AND `sentry_filtervalue`.`value` = 'Chrome' AND `sentry_filtervalue`.`key` = 'browser.name' )", u'time': u'0.001'}, {u'sql': u"UPDATE `sentry_messagefiltervalue` SET `times_seen` = `sentry_messagefiltervalue`.`times_seen` + 1, `project_id` = 815, `last_seen` = '2018-05-22 10:54:14' WHERE (`sentry_messagefiltervalue`.`group_id` = 592 AND `sentry_messagefiltervalue`.`value` = 'Chrome' AND `sentry_messagefiltervalue`.`key` = 'browser.name' )", u'time': u'0.001'}, {u'sql': u"UPDATE `sentry_filtervalue` SET `times_seen` = `sentry_filtervalue`.`times_seen` + 1, `data` = NULL, `last_seen` = '2018-05-22 10:54:14' WHERE (`sentry_filtervalue`.`project_id` = 815 AND `sentry_filtervalue`.`value` = 'Chrome 28.0.1500' AND `sentry_filtervalue`.`key` = 'browser' )", u'time': u'0.001'}, {u'sql': u"UPDATE `sentry_messagefiltervalue` SET `times_seen` = `sentry_messagefiltervalue`.`times_seen` + 1, `project_id` = 815, `last_seen` = '2018-05-22 10:54:14' WHERE (`sentry_messagefiltervalue`.`group_id` = 592 AND `sentry_messagefiltervalue`.`value` = 'Chrome 28.0.1500' AND `sentry_messagefiltervalue`.`key` = 'browser' )", u'time': u'0.001'}, {u'sql': u'SELECT `sentry_groupedmessage`.`id`, `sentry_groupedmessage`.`project_id`, `sentry_groupedmessage`.`logger`, `sentry_groupedmessage`.`level`, `sentry_groupedmessage`.`message`, `sentry_groupedmessage`.`view`, `sentry_groupedmessage`.`num_comments`, `sentry_groupedmessage`.`platform`, `sentry_groupedmessage`.`status`, `sentry_groupedmessage`.`times_seen`, `sentry_groupedmessage`.`last_seen`, `sentry_groupedmessage`.`first_seen`, `sentry_groupedmessage`.`first_release_id`, `sentry_groupedmessage`.`resolved_at`, `sentry_groupedmessage`.`active_at`, `sentry_groupedmessage`.`time_spent_total`, `sentry_groupedmessage`.`time_spent_count`, `sentry_groupedmessage`.`score`, `sentry_groupedmessage`.`is_public`, `sentry_groupedmessage`.`data`, `sentry_groupedmessage`.`short_id` FROM `sentry_groupedmessage` WHERE `sentry_groupedmessage`.`id` = 592 ', u'time': u'0.001'}, {u'sql': u'SELECT `sentry_groupsnooze`.`id`, `sentry_groupsnooze`.`group_id`, `sentry_groupsnooze`.`until`, `sentry_groupsnooze`.`count`, `sentry_groupsnooze`.`window`, `sentry_groupsnooze`.`user_count`, `sentry_groupsnooze`.`user_window`, `sentry_groupsnooze`.`state`, `sentry_groupsnooze`.`actor_id` FROM `sentry_groupsnooze` WHERE `sentry_groupsnooze`.`group_id` = 592 ', u'time': u'0.000'}, {u'sql': u'SELECT `sentry_grouprulestatus`.`id`, `sentry_grouprulestatus`.`project_id`, `sentry_grouprulestatus`.`rule_id`, `sentry_grouprulestatus`.`group_id`, `sentry_grouprulestatus`.`status`, `sentry_grouprulestatus`.`date_added`, `sentry_grouprulestatus`.`last_active` FROM `sentry_grouprulestatus` WHERE (`sentry_grouprulestatus`.`group_id` = 592 AND `sentry_grouprulestatus`.`rule_id` = 827 )', u'time': u'0.001'}, {u'sql': u'SAVEPOINT `s47055674149248_x55`', u'time': u'0.000'}, {u'sql': u'RELEASE SAVEPOINT `s47055674149248_x55`', u'time': u'0.000'}] ) assert result == { 'nodestore_node': 2, 'sentry_environmentproject': 1, 'sentry_eventtag': 1, 'sentry_eventuser': 1, 'sentry_filtervalue': 6, 'sentry_groupedmessage': 1, 'sentry_message': 1, 'sentry_messagefiltervalue': 6, 'sentry_userreport': 1 }