Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to change database name? #20

Open
pedrokost opened this issue Jun 16, 2017 · 1 comment
Open

How to change database name? #20

pedrokost opened this issue Jun 16, 2017 · 1 comment

Comments

@pedrokost
Copy link

pedrokost commented Jun 16, 2017

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
Copy link

From postgresql.py:

def dsn(self, **kwargs):
# "database=test host=localhost user=postgres"
params = dict(kwargs)
params.setdefault('port', self.settings['port'])
params.setdefault('host', '127.0.0.1')
params.setdefault('user', 'postgres')
params.setdefault('database', 'test')
return params

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants