django-db-call
Copyright (c) 2014, Friedrich Paetzke (f.paetzke@gmail.com) All rights reserved.
Django-db-call creates a database configuration for a django project from command line input.
It supports MySQL and PostgreSQL⁽¹⁾ right now.
It comes with two functions:
from_call()
from_calls()
You can install django-db-call via pip.
$ pip install django-db-call
An usage example:
from django_db_call import from_call
DATABASES = from_call('mysql -h localhost -u root -p my_sweet_secret -D my_db')
That will become:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'PORT': '',
'PASSWORD': 'my_sweet_secret',
'HOST': 'localhost',
'NAME': 'my_db',
'USER': 'root'
}
}
You can change the connection name by passing a name for it:
DATABASES = from_call('mysql', connection='not_default')
And that is equivalent to:
DATABASES = {
'not_default': {
'ENGINE': 'django.db.backends.mysql',
'HOST': '',
'NAME': '',
'PASSWORD': '',
'PORT': '',
'USER': ''
}
}
You can also pass additional arguments to be used in OPTIONS.
DATABASES = from_call('mysql', autocommit=True)
And that will give you:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': '',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
'OPTIONS': {
'autocommit': True,
},
}
}
For creating multiple databases connections you can use from_calls().
from django_db_call import from_calls
DATABASES = from_calls(
[
['mysql -h localhost -u root -p my_sweet_secret -D my_db'],
['mysql -h localhost -u root -p my_sweet_secret -D archive',
{'connection': 'archive'}],
])
And that will result in:
DATABASES = {
'default': {
'PASSWORD': 'my_sweet_secret',
'ENGINE': 'django.db.backends.mysql',
'PORT': '',
'USER': 'root',
'HOST': 'localhost',
'NAME': 'my_db'
},
'archive': {
'PASSWORD': 'my_sweet_secret',
'ENGINE': 'django.db.backends.mysql',
'PORT': '',
'USER': 'root',
'HOST': 'localhost',
'NAME': 'archive'
}
}
⁽¹⁾ It seems it is not possible to pass the password to use a specific database on psql. You have pass it explicitly.
DATABASES = from_call('psql', password='my_sweet_secret')
Metadata
Release files for django-db-call 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-db-call-0.2.0.tar.gz | 4.0 kB | Without provenance | Details for django-db-call-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_db_call-0.2.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for django_db_call-0.2.0-py2.py3-none-any.whl |
Total release size: 9.4 kB
Release files / django-db-call-0.2.0.tar.gz
| Download URL | django-db-call-0.2.0.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b331567c12bdb04cfa1465295001e9779228dfc0cd61328c5806ad26ad311e72
|
|
BLAKE2b-256 checksum How to use checksums |
eab659cc34d8136c8e2b143a9f428367081261df3145779adaf50938ea017781
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / django_db_call-0.2.0-py2.py3-none-any.whl
| Download URL | django_db_call-0.2.0-py2.py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
032bf4b9edead34325d9bd6476cfd1ce0bef095d71e7ef190ef4e69f58eeacaf
|
|
BLAKE2b-256 checksum How to use checksums |
0b3a1bd748d6e67ef8c2c7d6279a56b3e80bade4a7bbc568204adcb0bd976481
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-db-call 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.