tk0miya / testing.postgresql

Apache License 2.0
290 stars 46 forks source link

How to change database name? #20

Open pedrokost opened 7 years ago

pedrokost commented 7 years ago

Is it possible to change the database name, and other configuration apart from the port?

I am trying to do this:

Postgresql = testing.postgresql.PostgresqlFactory(
    cache_initialized_db=True, 
    on_initialized=handler, 
    port=settings.DB_SETTINGS['port'],
    database=settings.DB_SETTINGS['name'],
    user=settings.DB_SETTINGS['user'],
    host=settings.DB_SETTINGS['host']
)

When in the handler method, when running

print(postgresql.dsn())

I receive the default configuration, not the parameters I passed in.

ThomasKraaibeek commented 2 years ago

From postgresql.py:

https://github.com/tk0miya/testing.postgresql/blob/c81ded434d00ec8424de0f9e1f4063c778c6aaa8/src/testing/postgresql.py#L57-L65

Seems like dsn() only returns those default params, since you did not put any in as parameters.