Keyword URLs supported in database connection?
http://docs.peewee-orm.com/en/latest/peewee/playhouse.html#db-url
On Feb 14, 2015 5:12 PM, "Samuel Marks" notifications@github.com wrote:

> Looking through your examples, looks like I need seperated values rather
> than a single URL.
> 
> So going off that:
> 
> from os import environ
> from operator import add
> 
> environ.setdefault('HEROKU_POSTGRESQL_AMBER', 'postgres://username:password@hostname:PORT/dbname')
> 
> username, password, hostname, PORT, dbname = reduce(add,
>                                                     reduce(add,
>                                    map(lambda e: map(lambda i: i.split('/'), e),
>                                        map(lambda elem: elem.split(':'),
>                                            environ['HEROKU_POSTGRESQL_AMBER'][
>                                            environ['HEROKU_POSTGRESQL_AMBER'].find(
>                                                '//') + 2:].split('@')))))
> 
> I can then do:
> 
> from playhouse.postgres_ext import PostgresqlExtDatabase
> 
> psql_db = PostgresqlExtDatabase(dbname, user=username)
> 
> Unfortunately PostgresqlExtDatabase.**init** isn't documents and just
> uses _args and *_kwargs everywhere.
> 
> _How do I provide all these details to the initialiser?_
> 
> —
> Reply to this email directly or view it on GitHub
> https://github.com/coleifer/peewee/issues/528.
 You can use the db_url module or you can check the documentation on psycopg2. Besides the name of the database, all the other args are passed directly to psycopg2.
 Thanks, that worked.

Looking through your examples, looks like I need seperated values rather than a single URL.

So going off that:

```
from os import environ
from operator import add

environ.setdefault('HEROKU_POSTGRESQL_AMBER', 'postgres://username:password@hostname:PORT/dbname')

username, password, hostname, PORT, dbname = reduce(
    add, reduce(add,
                map(lambda e: map(lambda i: i.split('/'), e),
                    map(lambda elem: elem.split(':'),
                        (lambda e: e[e.find('//') + 2:].split('@'))(
                            environ['HEROKU_POSTGRESQL_AMBER']
                        )))))
```

I can then do:

```
from playhouse.postgres_ext import PostgresqlExtDatabase

psql_db = PostgresqlExtDatabase(dbname, user=username)
```

Unfortunately `PostgresqlExtDatabase.__init__` isn't documented; and just uses `*args` and `**kwargs` everywhere.

**How do I provide all these details to the initialiser?**
