def _path_to_sqlite_uri(path):
    "Convert a path into a SQLite compatible URI.\n\n    Unlike pathlib's URI handling, SQLite accepts relative URI paths.\n    For details, see:\n\n        https://www.sqlite.org/uri.html#the_uri_path\n    "
    if (os.name == 'nt'):
        if re.match('^[a-zA-Z]:', path):
            path = os.path.abspath(path)
            drive_prefix = f'/{path[:2]}'
            path = path[2:]
        else:
            drive_prefix = ''
        path = path.replace('\\', '/')
        path = urllib_parse_quote(path)
        path = f'{drive_prefix}{path}'
    else:
        path = urllib_parse_quote(path)
    path = re.sub('/+', '/', path)
    return f'file:{path}'
Convert a path into a SQLite compatible URI.

Unlike pathlib's URI handling, SQLite accepts relative URI paths.
For details, see:

    https://www.sqlite.org/uri.html#the_uri_path
def _path_to_sqlite_uri(path):
    "Convert a path into a SQLite compatible URI.\n\n    Unlike pathlib's URI handling, SQLite accepts relative URI paths.\n    For details, see:\n\n        https://www.sqlite.org/uri.html#the_uri_path\n    "
    if (os.name == 'nt'):
        if re.match('^[a-zA-Z]:', path):
            path = os.path.abspath(path)
            drive_prefix = f'/{path[:2]}'
            path = path[2:]
        else:
            drive_prefix = 
        path = path.replace('\\', '/')
        path = urllib_parse_quote(path)
        path = f'{drive_prefix}{path}'
    else:
        path = urllib_parse_quote(path)
    path = re.sub('/+', '/', path)
    return f'file:{path}'