Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Belgian Biodiversity Platform
cputils
Commits
13b45d0c
Commit
13b45d0c
authored
Sep 01, 2016
by
Julien Cigar
🤘
Browse files
add support for poolclass
parent
06e57e5d
Changes
1
Hide whitespace changes
Inline
Side-by-side
plugins/sa_plugin.py
View file @
13b45d0c
...
...
@@ -2,6 +2,7 @@
from
cherrypy.process
import
plugins
import
sqlalchemy.pool
from
sqlalchemy
import
create_engine
,
MetaData
from
sqlalchemy.orm
import
scoped_session
,
sessionmaker
...
...
@@ -61,6 +62,10 @@ class SAEnginePlugin(plugins.SimplePlugin):
if
not
self
.
sa_engine
:
url
=
_config
[
'engine'
].
pop
(
'url'
)
pool_factory
=
_config
[
'engine'
].
pop
(
'poolclass'
,
None
)
if
pool_factory
:
poolclass
=
getattr
(
sqlalchemy
.
pool
,
pool_factory
)
_config
[
'engine'
][
'poolclass'
]
=
poolclass
self
.
sa_engine
=
create_engine
(
url
,
**
_config
[
'engine'
])
# Metadata
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment