@contextlib.contextmanager<EOL><INDENT>def allow_sync(self):<DEDENT>
old_allow_sync = self._allow_sync<EOL>self._allow_sync = True<EOL>try:<EOL><INDENT>yield<EOL><DEDENT>except:<EOL><INDENT>raise<EOL><DEDENT>finally:<EOL><INDENT>try:<EOL><INDENT>self.close()<EOL><DEDENT>except self.Error:<EOL><INDENT>pass  <EOL><DEDENT><DEDENT>self._allow_sync = old_allow_sync<EOL>
Allow sync queries within context. Close sync
        connection on exit if connected.

        Example::

            with database.allow_sync():
                PageBlock.create_table(True)