Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

dont use bind because ronny says so

  • Loading branch information...
commit 9b85b9e8ee758dbe49ebd3a00693df3e05e1c088 1 parent a741687
David Cramer authored August 10, 2011

Showing 1 changed file with 9 additions and 6 deletions. Show diff stats Hide diff stats

  1. 15  sentry/db/backends/sqlalchemy/backend.py
15  sentry/db/backends/sqlalchemy/backend.py
@@ -20,7 +20,6 @@
20 20
 class SQLAlchemyBackend(SentryBackend):
21 21
     def __init__(self, uri, **kwargs):
22 22
         self.engine = create_engine(uri, **kwargs)
23  
-        metadata.bind = self.engine
24 23
 
25 24
     def create_model(self, schema):
26 25
         metadata.create(model_map[schema])
@@ -31,25 +30,29 @@ def add(self, schema, **values):
31 30
         # generates a pk and sets the values
32 31
         pk = self.generate_key(schema)
33 32
         table = model_map[schema]
34  
-        table.insert().execute(id=pk, **values)
  33
+        query = table.insert(id=pk, **values)
  34
+        self.engine.execute(query)
35 35
         return pk
36 36
 
37 37
     def delete(self, schema, pk):
38 38
         table = model_map[schema]
39  
-        table.delete(table.c.id==pk).execute()
  39
+        query = table.delete(table.c.id==pk)
  40
+        self.engine.execute(query)
40 41
 
41 42
     def set(self, schema, pk, **values):
42 43
         table = model_map[schema]
43  
-        table.update(table.c.id==pk).execute(**values)
  44
+        query = table.update(table.c.id==pk).values(**values)
  45
+        self.engine.execute(query)
44 46
 
45 47
     def get(self, schema, pk):
46 48
         table = model_map[schema]
47 49
         query = select([table], table.c.id==pk)
48  
-        return query.execute().fetchone()
  50
+        return self.engine.execute(query).fetchone()
49 51
 
50 52
     def incr(self, schema, pk, key, amount=1):
51 53
         table = model_map[schema]
52  
-        table.update(table.c.id==pk, {key: getattr(table.c, key) + amount}).execute()
  54
+        query = table.update(table.c.id==pk, {key: getattr(table.c, key) + amount})
  55
+        self.engine.execute(query)
53 56
     
54 57
     # meta data is stored in a seperate key to avoid collissions and heavy getall pulls
55 58
 

0 notes on commit 9b85b9e

Please sign in to comment.
Something went wrong with that request. Please try again.