class_docstr: The SQLStorageAdapter allows ChatterBot to store conversation
  data in any database supported by the SQL Alchemy ORM.
  
  All parameters are optional, by default a sqlite database is used.
  
  It will check if tables are present, if they are not, it will attempt
  to create the required tables.
  
  :keyword database_uri: eg: sqlite:///database_test.sqlite3',
      The database_uri can be specified to choose database driver.
  :type database_uri: str
class_docstr_tok: ["The","SQLStorageAdapter","allows","ChatterBot","to","store","conversation","data","in","any","database","supported","by","the","SQL","Alchemy","ORM",".","All","parameters","are","optional",",","by","default","a","sqlite","database","is","used",".","It","will","check","if","tables","are","present",",","if","they","are","not",",","it","will","attempt","to","create","the","required","tables",".",":","keyword","database_uri",":","eg",":","sqlite",":","\/\/\/database_test.sqlite3","'",",","The","database_uri","can","be","specified","to","choose","database","driver",".",":","type","database_uri",":","str"]
code: def __init__(self, **kwargs):
      super().__init__(**kwargs)
  
      from sqlalchemy import create_engine
      from sqlalchemy.orm import sessionmaker
  
      self.database_uri = kwargs.get("database_uri", False)
  
      # None results in a sqlite in-memory database as the default
      if self.database_uri is None:
          self.database_uri = "sqlite://"
  
      # Create a file database if the database is not a connection string
      if not self.database_uri:
          self.database_uri = "sqlite:///db.sqlite3"
  
      self.engine = create_engine(
          self.database_uri, convert_unicode=True
      )
  
      if self.database_uri.startswith("sqlite://"):
          from sqlalchemy.engine import Engine
          from sqlalchemy import event
  
          @event.listens_for(Engine, "connect")
          def set_sqlite_pragma(dbapi_connection, connection_record):
              dbapi_connection.execute("PRAGMA journal_mode=WAL")
              dbapi_connection.execute("PRAGMA synchronous=NORMAL")
  
      if not self.engine.dialect.has_table(self.engine, "Statement"):
          self.create_database()
  
      self.Session = sessionmaker(
          bind=self.engine, expire_on_commit=True
      )
  
file_path: ChatterBot/chatterbot/storage/sql_storage.py
imports: from chatterbot.storage import StorageAdapter
label_desc: Use image node_id 1 to create a new SQLStorageAdapter object from inherited base classes: StorageAdapter with example: obj = SQLStorageAdapter()