1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
sqldsn
======
:synopsis: Prints Data Source Name connection string on stdout
Supported Databases
-------------------
Currently the following databases are supported:
* PostgreSQL (psycopg2, psycopg3, or postgis)
* Sqlite3
* MySQL
Patches to support other databases are welcome! :-)
Supported Styles
----------------
Currently the following databases are supported:
+----------+------------+-------+---------+---------------------------+
| Style | PostgreSQL | MySQL | Sqlite3 | Description |
+==========+============+=======+=========+===========================+
| args | | Y | | command-line arguments |
+----------+------------+-------+---------+---------------------------+
| filename | | | Y | filename |
+----------+------------+-------+---------+---------------------------+
| keyvalue | Y | Y | | key-value pairs (legacy) |
+----------+------------+-------+---------+---------------------------+
| kwargs | Y | | | Python keyword arguments |
+----------+------------+-------+---------+---------------------------+
| pgpass | Y | | | ``.pgpass`` format |
+----------+------------+-------+---------+---------------------------+
| uri | Y | Y | Y | (See ``dj-database-url``) |
+----------+------------+-------+---------+---------------------------+
Exit Codes
----------
Exit status is 0 unless invalid options were given.
Example Usage
-------------
::
# Prints the DSN for the default database
$ ./manage.py sqldsn
::
# Prints the DSN for all databases
$ ./manage.py sqldsn --all
::
# Print the DSN for database named 'slave'
$ ./manage.py sqldsn --database=slave
::
# Print all DSN styles available for the default database
$ ./manage.py sqldsn --style=all
::
# Print the URI for the default database
$ ./manage.py sqldsn -q --style=uri
::
# Create .pgpass file for default database by using the quiet option
$ ./manage.py sqldsn -q --style=pgpass > .pgpass
|