How to escape parenthesis in environment variable?

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

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

But whatever I do, I doesn’t help - https://travis-ci.com/epam/OSCI/builds/145174414#L190

Setting environment variables from .travis.yml
$ export DATABASE_URL=mssql+pyodbc://sa:yourStrong(!)Password@127.0.0.1:1433/{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@127.0.0.1:1433/{db_name}?driver=FreeTDS&autocommit=True '

I tried.

  1. Using single quotes - https://travis-ci.com/epam/OSCI/builds/145175945 - the same error
  2. Escaping with \( - build didn’t start - invalid YAML
  3. Escaping with \\( - https://travis-ci.com/epam/OSCI/builds/145177245 - 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 \\\\\( - https://travis-ci.com/epam/OSCI/builds/145196364 - the same error as 1

I tried \(!\) with single quotes - the original error is gone, the build continued https://travis-ci.com/epam/OSCI/builds/145202827 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.

https://travis-ci.com/epam/OSCI/builds/145205329

The solution was to use triple single quotes.

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