Example #1
0
 def insert(self, owner_id, dashboard_name, dashboard_options):
     dashboard_id = gen_uuid()
     row = dict(owner_id=owner_id,
                dashboard_id=dashboard_id,
                dashboard_name=dashboard_name,
                dashboard_options=dashboard_options)
     c.cass.execute(insert('mqe.dashboard', row))
     return row
Example #2
0
 def insert(self, owner_id, dashboard_name, dashboard_options):
     dashboard_id = gen_uuid()
     row = dict(owner_id=owner_id,
                dashboard_id=dashboard_id,
                dashboard_name=dashboard_name,
                dashboard_options=dashboard_options)
     with cursor() as cur:
         cur.execute(*insert('dashboard', row))
     return row
Example #3
0
 def insert(self, email, password):
     if self.select_by_email(email) is not None:
         raise ValueError('User exists: %r' % email)
     user_id = gen_uuid()
     pw_hash = werkzeug.security.generate_password_hash(password)
     with cursor() as cur:
         cur.execute(*insert(
             'user', {
                 'user_id': user_id,
                 'email': email,
                 'password': pw_hash,
                 'created': datetime.datetime.utcnow(),
             }))
         return self.select(user_id)
Example #4
0
 def insert(self, email, password):
     if self.select_by_email(email) is not None:
         raise ValueError('User exists: %r' % email)
     user_id = gen_uuid()
     pw_hash = werkzeug.security.generate_password_hash(password)
     c.cass.execute(
         batch(
             insert(
                 'mqe.user', {
                     'user_id': user_id,
                     'email': email,
                     'password': pw_hash,
                     'created': datetime.datetime.utcnow(),
                     'user_data': serialize.mjson({}),
                 }),
             insert('mqe.user_by_email', {
                 'email': email,
                 'user_id': user_id
             }),
         ))
     return self.select(user_id)