I would like to use raw SQL command to do a query.
engine = create_engine(os.getenv("DATABASE_URL"))
db = scoped_session(sessionmaker(bind=engine))
My table name is books
and title
is a column in it. I have got the value of detail
from a form.
detail=request.form.get("detail")
book=db.execute("SELECT title FROM books WHERE title = :detail",{"detail":detail})
What i want is to run this query with LIKE
command such that I can have title as LIKE detail, that is, I want something like:
book=db.execute("SELECT title FROM books WHERE title LIKE *:detail*",{"detail":detail})
to have value of title to be comprising of characters of detail and some characters before and after denoted by * as wildcards. Could you help me to achieve this, remember I want to use raw SQL commands only.