✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🧬 Learn how to build RNA-Seq data apps with Python & Dash. Register for the May 20 Webinar!

dcc.Input Textbox to Allow Insertion of Apostrophes to Postgre database


We currently created an app using Dash as the front-end framework while Postgres for its back-end database. So my only question is, given I have a dcc.Input with type Text, I can type any text on it including apostrophes (’), however, using a callback to insert the value from that input into postgres will not allow because of the single apostrophe.

sql= '''INSERT INTO stores (store_name, store_delete_ind) VALUES(%s,%s)'''
values = (storenamefrominput, False)

insertintodb(sql, values)

Where insertintodb() is a defined function connecting to the postgres db.

Of course in postgres, we know that to insert apostrophes, we just use 2 single apostrophes. But in my callback, it will not be allowed unless the user specifically inputted 2 single apostrophes.

I hope you can help me with this. Thank you!