Skip to content

Maximum number of tokens exceeded (10000). #1432

Closed

Description

@your-diary

When I try to execute a SELECT query with a long IN, mycli refuses to run it, saying:

Maximum number of tokens exceeded (10000).

I suspect this because mycli depends on sqlparse and sqlparse has a hard-coded length limit for input string:

As suggested by a maintainer, one possible workaround is this:

import sqlparse.engine.grouping

# Increase limits (use with caution)
sqlparse.engine.grouping.MAX_GROUPING_DEPTH = 200
sqlparse.engine.grouping.MAX_GROUPING_TOKENS = 50000

# Disable limits completely (use with extreme caution)
sqlparse.engine.grouping.MAX_GROUPING_DEPTH = None
sqlparse.engine.grouping.MAX_GROUPING_TOKENS = None

Given that the constraint is to prevent DoS and that mycli is, as far as I believe, not a tool for handling input by random users on the Internet, could you please disable or expose an option to override the behavior?

Activity

  1. rolandwalker commented on Jan 9, 2026

    @rolandwalker
    Contributor

    Thanks for the catch! Seems like we can disable the DOS defense.

  2. rolandwalker commented on Jan 10, 2026

    @rolandwalker
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions