Hi, I am trying to do use SQLAlchemy with the MongoDB BI connector, which presents itself as a MySQL server. However, the supported operations correspond only to the SQL-99 SELECT operations (i.e. it's a read only server) . See:
https://docs.mongodb.com/bi-connector/master/supported-operations/ Issuing the following set of commands results in the subsequent backtrace shown below. Is there any way to specify that SQLALchemy should not attempt to write to the connected database? Is that actually the cause of the backtrace? Many thanks, Jonathan from sqlalchemy import create_engine engine = create_engine('mysql://USERNAME:passw...@bicon.domain.com:3307') engine.table_names() /opt/superset27/lib/python2.7/site-packages/sqlalchemy/util/langhelpers.py:74: SAWarning: An exception has occurred during handling of a previous exception. The previous exception is: <class '_mysql_exceptions.OperationalError'> (1046, 'No database selected') "is:\n %s %s\n" % (self._exc_info[0], self._exc_info[1])) No handlers could be found for logger "sqlalchemy.pool.QueuePool" --------------------------------------------------------------------------- OperationalError Traceback (most recent call last) <ipython-input-6-cd60cd4a61c5> in <module>() ----> 1 engine.table_names() /opt/superset27/lib/python2.7/site-packages/sqlalchemy/engine/base.pyc in table_names(self, schema, connection) 2126 if not schema: 2127 schema = self.dialect.default_schema_name -> 2128 return self.dialect.get_table_names(conn, schema) 2129 2130 def has_table(self, table_name, schema=None): <string> in get_table_names(self, connection, schema, **kw) /opt/superset27/lib/python2.7/site-packages/sqlalchemy/engine/reflection.pyc in cache(fn, self, con, *args, **kw) 40 info_cache = kw.get('info_cache', None) 41 if info_cache is None: ---> 42 return fn(self, con, *args, **kw) 43 key = ( 44 fn.__name__, /opt/superset27/lib/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyc in get_table_names(self, connection, schema, **kw) 1714 rp = connection.execute( 1715 "SHOW FULL TABLES FROM %s" % -> 1716 self.identifier_preparer.quote_identifier(current_schema)) 1717 1718 return [row[0] /opt/superset27/lib/python2.7/site-packages/sqlalchemy/engine/base.pyc in execute(self, object, *multiparams, **params) 937 """ 938 if isinstance(object, util.string_types[0]): --> 939 return self._execute_text(object, multiparams, params) 940 try: 941 meth = object._execute_on_connection /opt/superset27/lib/python2.7/site-packages/sqlalchemy/engine/base.pyc in _execute_text(self, statement, multiparams, params) 1095 statement, 1096 parameters, -> 1097 statement, parameters 1098 ) 1099 if self._has_events or self.engine._has_events: /opt/superset27/lib/python2.7/site-packages/sqlalchemy/engine/base.pyc in _execute_context(self, dialect, constructor, statement, parameters, *args) 1187 parameters, 1188 cursor, -> 1189 context) 1190 1191 if self._has_events or self.engine._has_events: /opt/superset27/lib/python2.7/site-packages/sqlalchemy/engine/base.pyc in _handle_dbapi_exception(self, e, statement, parameters, cursor, context) 1393 self._safe_close_cursor(cursor) 1394 with util.safe_reraise(warn_only=True): -> 1395 self._autorollback() 1396 1397 if newraise: /opt/superset27/lib/python2.7/site-packages/sqlalchemy/util/langhelpers.pyc in __exit__(self, type_, value, traceback) 74 "is:\n %s %s\n" % (self._exc_info[0], self._exc_info[1])) 75 self._exc_info = None # remove potential circular references ---> 76 compat.reraise(type_, value, traceback) 77 78 /opt/superset27/lib/python2.7/site-packages/sqlalchemy/engine/base.pyc in _handle_dbapi_exception(self, e, statement, parameters, cursor, context) 1393 self._safe_close_cursor(cursor) 1394 with util.safe_reraise(warn_only=True): -> 1395 self._autorollback() 1396 1397 if newraise: /opt/superset27/lib/python2.7/site-packages/sqlalchemy/engine/base.pyc in _autorollback(self) 822 def _autorollback(self): 823 if not self._root.in_transaction(): --> 824 self._root._rollback_impl() 825 826 def close(self): /opt/superset27/lib/python2.7/site-packages/sqlalchemy/engine/base.pyc in _rollback_impl(self) 701 self.engine.dialect.do_rollback(self.connection) 702 except BaseException as e: --> 703 self._handle_dbapi_exception(e, None, None, None, None) 704 finally: 705 if not self.__invalid and \ /opt/superset27/lib/python2.7/site-packages/sqlalchemy/engine/base.pyc in _handle_dbapi_exception(self, e, statement, parameters, cursor, context) 1321 self.dialect.dbapi.Error, 1322 dialect=self.dialect), -> 1323 exc_info 1324 ) 1325 self._reentrant_error = True /opt/superset27/lib/python2.7/site-packages/sqlalchemy/util/compat.pyc in raise_from_cause(exception, exc_info) 201 exc_type, exc_value, exc_tb = exc_info 202 cause = exc_value if exc_value is not exception else None --> 203 reraise(type(exception), exception, tb=exc_tb, cause=cause) 204 205 if py3k: /opt/superset27/lib/python2.7/site-packages/sqlalchemy/engine/base.pyc in _rollback_impl(self) 699 self.engine.logger.info("ROLLBACK") 700 try: --> 701 self.engine.dialect.do_rollback(self.connection) 702 except BaseException as e: 703 self._handle_dbapi_exception(e, None, None, None, None) /opt/superset27/lib/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyc in do_rollback(self, dbapi_connection) 1573 1574 try: -> 1575 dbapi_connection.rollback() 1576 except Exception: 1577 if self.server_version_info < (3, 23, 15): OperationalError: (_mysql_exceptions.OperationalError) (1105, 'statement *parser.Rollback not supported') -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.