How to escape parenthesis in environment variable?

I am trying to escape this environment variable with parenthesis in it.

  - DATABASE_URL: "mssql+pyodbc://sa:yourStrong(!)Password@{db_name}?driver=FreeTDS&autocommit=True"

But whatever I do, I doesn’t help -

Setting environment variables from .travis.yml
$ export DATABASE_URL=mssql+pyodbc://sa:yourStrong(!)Password@{db_name}?driver=FreeTDS&autocommit=True
/home/travis/.travis/functions: eval: line 109: syntax error near unexpected token `('
/home/travis/.travis/functions: eval: line 109: `export DATABASE_URL=mssql+pyodbc://sa:yourStrong(!)Password@{db_name}?driver=FreeTDS&autocommit=True '

I tried.

  1. Using single quotes - - the same error
  2. Escaping with \( - build didn’t start - invalid YAML
  3. Escaping with \\( - - the… wait… I was about to write that the output is the same, but it is now complaining about the closing )! It might be a valid solution. I still finish this for completeness
  4. Escaping with \\\\\( - - the same error as 1

I tried \(!\) with single quotes - the original error is gone, the build continued but the actual code that uses the variable failed and I need more test to troubleshoout it.

Because I also already wasted a couple of hours here as this gentleman below, I highly recommend upvoting his proposal.

The problem is not solved. There is no error while setting the variable, but the variable is empty.

The solution was to use triple single quotes.

  # MSSQL support, 1 line
  - DATABASE_URL: '''mssql+pyodbc://sa:yourStrong(!)Password@{db_name}?driver=FreeTDS&autocommit=True'''