Here are the examples of the python api sqlalchemy.sa_exc.SAWarning taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2 Examples
3
Example 1
Project: tvb-framework Source File: profile_settings.py
def initialize_for_deployment(self):
"""
Specific initialization for deployment and framework settings
"""
super(WebSettingsProfile, self).initialize_for_deployment()
inside_static_folder = os.path.join(self.EXTERNALS_FOLDER_PARENT, 'tvb')
self.web.CHERRYPY_CONFIGURATION['/statichelp']['tools.staticdir.root'] = inside_static_folder
#We want to disable warnings we get from sqlalchemy for traited attributes when we are in deployment mode.
import warnings
from sqlalchemy import exc as sa_exc
warnings.simplefilter("ignore", category=sa_exc.SAWarning)
3
Example 2
def expect_warnings(*messages, **kw):
"""Context manager which expects one or more warnings.
With no arguments, squelches all SAWarnings emitted via
sqlalchemy.util.warn and sqlalchemy.util.warn_limited. Otherwise
pass string expressions that will match selected warnings via regex;
all non-matching warnings are sent through.
The expect version **asserts** that the warnings were in fact seen.
Note that the test suite sets SAWarning warnings to raise exceptions.
"""
return _expect_warnings(sa_exc.SAWarning, messages, **kw)