Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Video AG Infrastruktur
website
Commits
330b744c
Commit
330b744c
authored
10 months ago
by
Simon Künzel
Browse files
Options
Downloads
Patches
Plain Diff
Change psycopg version from 3 to 2
parent
ca91307f
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
db.py
+4
-4
4 additions, 4 deletions
db.py
with
4 additions
and
4 deletions
db.py
+
4
−
4
View file @
330b744c
...
@@ -91,11 +91,11 @@ elif config['DB_ENGINE'] == 'mysql':
...
@@ -91,11 +91,11 @@ elif config['DB_ENGINE'] == 'mysql':
db
.
close
()
db
.
close
()
return
res
return
res
elif
config
[
'
DB_ENGINE
'
]
==
'
postgres
'
:
elif
config
[
'
DB_ENGINE
'
]
==
'
postgres
'
:
import
psycopg
# pylint: disable=import-error
import
psycopg
2
# pylint: disable=import-error
def
get_dbcursor
():
def
get_dbcursor
():
if
'
db
'
not
in
g
or
g
.
db
.
broken
:
if
'
db
'
not
in
g
or
g
.
db
.
closed
:
g
.
db
=
psycopg
.
Connection
.
connect
(
g
.
db
=
psycopg
2
.
connect
(
host
=
config
[
"
POSTGRES_HOST
"
],
host
=
config
[
"
POSTGRES_HOST
"
],
port
=
config
[
"
POSTGRES_PORT
"
],
port
=
config
[
"
POSTGRES_PORT
"
],
user
=
config
[
"
POSTGRES_USER
"
],
user
=
config
[
"
POSTGRES_USER
"
],
...
@@ -133,7 +133,7 @@ def query(operation, *params, delim="sep", nlfix=True):
...
@@ -133,7 +133,7 @@ def query(operation, *params, delim="sep", nlfix=True):
try
:
try
:
rows
=
cur
.
fetchall
()
rows
=
cur
.
fetchall
()
except
Exception
as
e
:
# pylint: disable=broad-except
except
Exception
as
e
:
# pylint: disable=broad-except
if
str
(
e
)
==
'
N
o result
set
to fetch
from.
'
or
str
(
e
)
==
"
the last operation didn
'
t produce a result
"
:
if
str
(
e
)
==
'
n
o result
s
to fetch
'
or
str
(
e
)
==
"
the last operation didn
'
t produce a result
"
:
# no problem, we were just at the end of the result set
# no problem, we were just at the end of the result set
pass
pass
else
:
else
:
...
...
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