Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(4)  |  Call(2)  |  Derive(0)  |  Import(2)

        def build_postgres_args(db_conf):
    args = []
    if db_conf['user']:
        args.append("--username=%s" % db_conf['user'])
    if db_conf['host']:
        args.append("--host=%s" % db_conf['host'])
    if db_conf['port']:
        args.append("--port=%s" % db_conf['port'])
    args.append(db_conf['db_name'])

    return ' '.join(args)
        


src/d/j/django-commands-HEAD/django_commands/management/commands/db_load.py   django-commands(Download)
from django.core.management.base import CommandError, LabelCommand
 
from django_commands.utils import get_db_conf, build_mysql_args, build_postgres_args
 
class Command(LabelCommand):
    def _load_postgresql_psycopg2_db(self, db_conf, infile):
        passwd = ('export PGPASSWORD=%s;' % db_conf['password']
                    if db_conf['password'] else '')
        return os.system('%s zcat %s | psql %s -f -' %
                (passwd, infile, build_postgres_args(db_conf)))

src/d/j/django-commands-HEAD/django_commands/management/commands/db_backup.py   django-commands(Download)
from django.core.management.base import CommandError, LabelCommand
 
from django_commands.utils import get_db_conf, build_mysql_args, build_postgres_args
 
class Command(LabelCommand):
        _check_writable(outfile)
        ret = os.system('%s pg_dump %s | gzip -9 > %s' %
                (passwd, build_postgres_args(db_conf), outfile))
 
        return ret, outfile