Convert Database object into database URL string
Using Drush:

drush sa @site --with-db-url


Or, to isolate just the db-url:

drush sa @site --with-db-url --format=csv --fields=db-url --field-labels=0