Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SqliteHook compatibility with SQLAlchemy engine #23790

Merged
merged 1 commit into from
May 19, 2022

Commits on May 19, 2022

  1. Fix SqliteHook compatibility with SQLAlchemy engine

    Same as apache#19508 but for Sqlite as described in https://docs.sqlalchemy.org/en/14/dialects/sqlite.html#connect-strings to be able to create a Sqlalchemy engine from the URI itself.
    
    Without this, it currently fails with the following error due to how we create URI in Connections. An absolute path is denoted by starting with a slash, means you need four slashes:
    
    ```
    url = sqlite://%2Ftmp%2Fsqlite.db
    
        def create_connect_args(self, url):
            if url.username or url.password or url.host or url.port:
    >           raise exc.ArgumentError(
                    "Invalid SQLite URL: %s\n"
                    "Valid SQLite URL forms are:\n"
                    " sqlite:///:memory: (or, sqlite://)\n"
                    " sqlite:///relative/path/to/file.db\n"
                    " sqlite:////absolute/path/to/file.db" % (url,)
                )
    E           sqlalchemy.exc.ArgumentError: Invalid SQLite URL: sqlite://%2Ftmp%2Fsqlite.db
    E           Valid SQLite URL forms are:
    E            sqlite:///:memory: (or, sqlite://)
    E            sqlite:///relative/path/to/file.db
    E            sqlite:////absolute/path/to/file.db
    ```
    kaxil committed May 19, 2022
    Configuration menu
    Copy the full SHA
    12f00a6 View commit details
    Browse the repository at this point in the history