sqlmapproject/sqlmap · error · SqlmapMissingDependence

SQLAlchemy not available

Error message

SQLAlchemy not available (e.g. 'pip%s install SQLAlchemy')

What it means

Dependency guard in the SQLAlchemy connector's connect(): importing SQLAlchemy raised ImportError, so the optional dependency is missing and the connection cannot proceed. The '%s' is filled with the pip command variant (e.g. 'pip3 install SQLAlchemy') appropriate for the running interpreter.

Solutions

  1. Install SQLAlchemy with the pip command shown in the message
  2. Run sqlmap with a direct driver connection string instead of sqlalchemy://
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at lib/utils/sqlalchemy.py:111 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of sqlmapproject/sqlmap@0a35b20e39 (2026-08-26). Data as JSON: /api/errors/daa9277c243ecc8b. Report an issue: GitHub.

Appendix: source

Thrown at lib/utils/sqlalchemy.py:111

                            raise SqlmapConnectionException("SQLAlchemy connection issue (obsolete version of pymssql ('%s') is causing problems)" % pymssql.__version__)
                    except ImportError:
                        pass
                    # Note: surface (as a proper SqlmapConnectionException) instead of silently continuing with self.connector left None
                    raise SqlmapConnectionException("SQLAlchemy connection issue ('%s')" % getSafeExString(ex))
                elif "invalid literal for int() with base 10: '0b" in traceback.format_exc():
                    raise SqlmapConnectionException("SQLAlchemy connection issue ('https://bitbucket.org/zzzeek/sqlalchemy/issues/3975')")
                else:
                    # Note: raise as SqlmapConnectionException (like the generic handler below) so the caller's native-connector
                    # fallback engages and no raw TypeError/ValueError can reach sqlmap's top-level handler
                    raise SqlmapConnectionException("SQLAlchemy connection issue ('%s')" % getSafeExString(ex))
            except SqlmapFilePathException:
                raise
            except Exception as ex:
                raise SqlmapConnectionException("SQLAlchemy connection issue ('%s')" % getSafeExString(ex))

            self.printConnected()
        else:
            raise SqlmapMissingDependence("SQLAlchemy not available (e.g. 'pip%s install SQLAlchemy')" % ('3' if six.PY3 else ""))

    def fetchall(self):
        try:
            retVal = []
            for row in self.cursor.fetchall():
                retVal.append(tuple(row))
            return retVal
        except _sqlalchemy.exc.ProgrammingError as ex:
            logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % getSafeExString(ex))
            return None

    def execute(self, query, commit=True):
        retVal = False

        # Reference: https://stackoverflow.com/a/69491015
        if hasattr(_sqlalchemy, "text"):
            query = _sqlalchemy.text(query)

View on GitHub (pinned to 0a35b20e39)