code: def connect(dbapi_connection, connection_record):
          
          try:
              cursor = dbapi_connection.cursor()
              try:
                  cursor.execute("PRAGMA foreign_keys = ON;")
                  cursor.execute("PRAGMA foreign_keys;")
                  if cursor.fetchone()[0] != 1:
                      raise Exception()
              finally:
                  cursor.close()
          except Exception:
              dbapi_connection.close()
              raise sqlite3.Error()
docs: Called once by SQLAlchemy for each new SQLite DB-API connection.
  
          Here is where we issue some PRAGMA statements to configure how we're
          going to access the SQLite database.
  
          @param dbapi_connection:
              A newly connected raw SQLite DB-API connection.
  
          @param connection_record:
              Unused by this method.