コード例 #1
0
ファイル: sql_storage.py プロジェクト: zxsted/ChatterBot
    def create_conversation(self):
        """
        Create a new conversation.
        """
        Conversation = self.get_model('conversation')

        session = self.Session()
        conversation = Conversation()

        session.add(conversation)
        session.flush()

        session.refresh(conversation)
        conversation_id = conversation.id

        session.commit()
        session.close()

        return conversation_id
コード例 #2
0
    def create_conversation(self):
        """
        Create a new conversation.
        """
        from chatterbot.ext.sqlalchemy_app.models import Conversation

        session = self.Session()
        conversation = Conversation()

        session.add(conversation)
        session.flush()

        session.refresh(conversation)
        conversation_id = conversation.id

        session.commit()
        session.close()

        return conversation_id