예제 #1
0
 def list_records(self):
     try:
         query = self.datastore.db_session.query(SqlIntegerSequencedItem)
         return list(query)
     except OperationalError as e:
         self.datastore.db_session.rollback()
         raise DatastoreTableError(e)
예제 #2
0
 def list_records(self):
     try:
         return list(IntegerSequencedRecord.objects.all())
     except (CQLEngineException, NoHostAvailable) as e:
         raise DatastoreConnectionError(e)
     except InvalidRequest as e:
         raise DatastoreTableError(e)
예제 #3
0
 def create_record(self):
     try:
         record = SqlIntegerSequencedItem()
         self.datastore.db_session.add(record)
         self.datastore.db_session.commit()
     except OperationalError as e:
         self.datastore.db_session.rollback()
         raise DatastoreTableError(e)
     return record
예제 #4
0
 def create_record(self):
     record = CqlIntegerSequencedItem(s=uuid4(), p=0, t='topic', d='{}')
     try:
         record.save()
     except (CQLEngineException, NoHostAvailable) as e:
         raise DatastoreConnectionError(e)
     except InvalidRequest as e:
         raise DatastoreTableError(e)
     return record
예제 #5
0
 def create_record(self):
     try:
         record = IntegerSequencedItemRecord(sequence_id=uuid4(), position=0)
         self.datastore.session.add(record)
         self.datastore.session.commit()
     except OperationalError as e:
         self.datastore.session.rollback()
         raise DatastoreTableError(e)
     return record
 def list_records(self):
     try:
         query = self.datastore.session.query(IntegerSequencedNoIDRecord)
         return list(query)
     except (OperationalError, ProgrammingError) as e:
         # OperationalError from sqlite, ProgrammingError from psycopg2.
         self.datastore.session.rollback()
         raise DatastoreTableError(e)
     finally:
         self.datastore.session.close()
예제 #7
0
 def create_record(self):
     record = IntegerSequencedRecord(sequence_id=uuid4(),
                                     position=0,
                                     topic="topic",
                                     state=b"{}")
     try:
         record.save()
     except (CQLEngineException, NoHostAvailable) as e:
         raise DatastoreConnectionError(e)
     except InvalidRequest as e:
         raise DatastoreTableError(e)
     return record
 def create_record(self):
     try:
         record = IntegerSequencedNoIDRecord(sequence_id=uuid4(),
                                             position=0,
                                             topic="topic",
                                             state=b"{}")
         self.datastore.session.add(record)
         self.datastore.session.commit()
     except (OperationalError, ProgrammingError) as e:
         self.datastore.session.rollback()
         raise DatastoreTableError(e)
     return record