Answer the question
In order to leave comments, you need to log in
Is it possible to implement permission to create/delete a database with a specific name only for a specific user in Postgres?
The complete task looks like this: in a django project, you need to connect a test database that you would like to have not a disk sqlight, but a normal one, but at the same time not giving too many rights and being able to completely delete and recreate it. Probably, you can use the key --keepdb
during tests so that it doesn’t physically crash the base, but simply completely cleans it (it works like that, right?), But it’s still interesting to find out about Postgres, is it possible.
Answer the question
In order to leave comments, you need to log in
https://docs.djangoproject.com/en/2.1/topics/testi... https://stackoverflow.com/questions/14186055/djang...
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'finance', # Or path to database file if using sqlite3.
'USER': 'django', # Not used with sqlite3.
'PASSWORD': 'mydb123', # Not used with sqlite3.
'HOST': '127.0.0.1', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
'TEST': {
'NAME': 'test_finance',
'USER': 'test_user',
},
}
}
I would advise you to create a separate user for tests and give him the right to create tables Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question