Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
core_tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
QuTech QDLabs
core_tools
Commits
bf070878
Commit
bf070878
authored
2 years ago
by
Sander de Snoo
Browse files
Options
Downloads
Patches
Plain Diff
Added GRANT CREATE ON SCHEMA public for Postgresql 15
parent
e41d0973
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/source/introduction_db.md
+10
-8
10 additions, 8 deletions
docs/source/introduction_db.md
with
10 additions
and
8 deletions
docs/source/introduction_db.md
+
10
−
8
View file @
bf070878
...
...
@@ -21,7 +21,7 @@ Steps:
*
CREATE USER myusername WITH PASSWORD 'mypasswd';
*
CREATE DATABASE 'mydbname';
*
GRANT ALL PRIVILEGES ON DATABASE 'mydbname' TO 'myusername';
In case you are running along with a server set up, it is recommended to have 'mydbname' to be the same as the one on the server.
In python you can run the following code to set up the database:
...
...
@@ -36,7 +36,7 @@ Arguments are:
*
dbname (str) : database to connect with (e.g. 'vandersypen_data')
*
project (str) : project for which the data will be saved
*
set_up (str) : set up at which the data has been measured
*
sample (str) : sample name
*
sample (str) : sample name
Setting up a remote database
...
...
@@ -56,9 +56,9 @@ The arguments are:
*
dbname (str) : database to connect with (e.g. 'vandersypen_data')
*
project (str) : project for which the data will be saved
*
set_up (str) : set up at which the data has been measured
*
sample (str) : sample name
*
sample (str) : sample name
Note that the admin of the server has to provide you with login credentials for the storage.
Note that the admin of the server has to provide you with login credentials for the storage.
### admin set up.
Example for a linux server running ubuntu.
...
...
@@ -81,9 +81,11 @@ Now, make the databases and users,
Then set up a database and related users:
```
SQL
CREATE USER myusername WITH PASSWORD 'mypasswd';
CREATE DATABASE
'
mydbname
'
;
CREATE DATABASE
"
mydbname
"
;
GRANT ALL PRIVILEGES ON DATABASE 'mydbname' TO 'myusername';
GRANT CREATE ON SCHEMA public TO 'myusername'
```
Note: The last line is required since release 15 of Postgresql.
The default install of postgress does not allow external connections. We can adjest this by typing
```
bash
...
...
@@ -102,9 +104,9 @@ and add the following line,
```
host all all 0.0.0.0/0 md5
```
Now restart the postgres services to apply the changes,
Now restart the postgres services to apply the changes,
```
bash
sudo
systemctl restart postgresql.service
sudo
systemctl restart postgresql.service
```
Note : also make sure port 5432 is open, e.g.:
```
bash
...
...
@@ -123,7 +125,7 @@ After this, you can set up the python connection using:
```
python
from
core_tools.data.SQL.connector
import
set_up_local_and_remote_storage
set_up_local_and_remote_storage
(
server
,
port
,
set_up_local_and_remote_storage
(
server
,
port
,
user_local
,
passwd_local
,
dbname_local
,
user_remote
,
passwd_remote
,
dbname_remote
,
project
,
set_up
,
sample
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment