Skip to content
This repository was archived by the owner on Jan 3, 2026. It is now read-only.
This repository was archived by the owner on Jan 3, 2026. It is now read-only.

Textual SQL expression 'SELECT name ... should be declared as text #304

Description

@davidswelt

Describe the bug

[A clear and concise description of what the bug is.]

Run.py

   Reddit Media Downloader 3.1.5
====================================
    (By ShadowMoose @ Github)

Loaded settings file [/Users/dr/Library/Application Support/RMD/settings.json].
Traceback (most recent call last):
  File "/Users/dr/Downloads/RedditDownloader-3.1.5/Run.py", line 177, in <module>
    redditdownloader.__main__.run()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/Users/dr/Downloads/RedditDownloader-3.1.5/redditdownloader/__main__.py", line 167, in run
    sql.init_from_settings()
    ~~~~~~~~~~~~~~~~~~~~~~^^
  File "/Users/dr/Downloads/RedditDownloader-3.1.5/redditdownloader/sql/__init__.py", line 62, in init_from_settings
    _init(db_file)
    ~~~~~^^^^^^^^^
  File "/Users/dr/Downloads/RedditDownloader-3.1.5/redditdownloader/sql/__init__.py", line 55, in _init
    _run_migrations(session())
    ~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/Users/dr/Downloads/RedditDownloader-3.1.5/redditdownloader/sql/__init__.py", line 133, in _run_migrations
    _check_legacy(conn)
    ~~~~~~~~~~~~~^^^^^^
  File "/Users/dr/Downloads/RedditDownloader-3.1.5/redditdownloader/sql/__init__.py", line 153, in _check_legacy
    rs = sess.execute('SELECT name FROM sqlite_master WHERE type="table" AND name="posts";')
  File "/Users/dr/Downloads/RedditDownloader-3.1.5/env/lib/python3.13/site-packages/sqlalchemy/orm/session.py", line 2365, in execute
    return self._execute_internal(
           ~~~~~~~~~~~~~~~~~~~~~~^
        statement,
        ^^^^^^^^^^
    ...<4 lines>...
        _add_event=_add_event,
        ^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Users/dr/Downloads/RedditDownloader-3.1.5/env/lib/python3.13/site-packages/sqlalchemy/orm/session.py", line 2149, in _execute_internal
    statement = coercions.expect(roles.StatementRole, statement)
  File "/Users/dr/Downloads/RedditDownloader-3.1.5/env/lib/python3.13/site-packages/sqlalchemy/sql/coercions.py", line 395, in expect
    resolved = impl._literal_coercion(
        element, argname=argname, **kw
    )
  File "/Users/dr/Downloads/RedditDownloader-3.1.5/env/lib/python3.13/site-packages/sqlalchemy/sql/coercions.py", line 621, in _literal_coercion
    return self._text_coercion(element, argname, **kw)
           ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/dr/Downloads/RedditDownloader-3.1.5/env/lib/python3.13/site-packages/sqlalchemy/sql/coercions.py", line 614, in _text_coercion
    return _no_text_coercion(element, argname)
  File "/Users/dr/Downloads/RedditDownloader-3.1.5/env/lib/python3.13/site-packages/sqlalchemy/sql/coercions.py", line 584, in _no_text_coercion
    raise exc_cls(
    ...<7 lines>...
    ) from err
sqlalchemy.exc.ArgumentError: Textual SQL expression 'SELECT name FROM sqlite_m...' should be explicitly declared as text('SELECT name FROM sqlite_m...')

Environment Info

  • OS: macOS, python3 3.13.3
  • RMD Version: 3.1.5

Screenshots/Information

If applicable, add screenshots (or copies of error printouts) to help explain your problem.
[Include links to failed URLs/Posts, names of Sources, or other useful info here]

Additional context

Requirement already satisfied: typing-extensions>=4.6.0 in ./env/lib/python3.13/site-packages (from sqlalchemy) (4.14.0)```

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions