sqlparse icon indicating copy to clipboard operation
sqlparse copied to clipboard

0.5.5 causing Maximum number of tokens exceeded in DBT queries

Open DmytryEmery opened this issue 11 months ago • 1 comments

Describe the bug It seems that DBT core has a dependency on this library, and the latest version 0.5.5 causes some issues with DBT. Specifically larger queries cause the error: Maximum number of tokens exceeded {number}

I suspect it's this commit: https://github.com/andialbrecht/sqlparse/commit/da67ac16b8fa2c5041458bee728c8a914bed2d37

I realize this is more of a DBT issue than this library, but wanted to give a heads up.

To Reproduce Using dbt 1.8 or higher, it pulls in this library as dependency. Not exactly sure, but a fairly large query (sorry I don't have an exact reproducible one I can share) The limit seemed relatively low.

Expected behavior Success, these are valid queries that previously had worked. Aside: terminology of 'tokens' while likely correct gets confusing LLMs being so common these days.

Versions (please complete the following information):

  • Python: 3.11.2
  • sqlparse: 0.5.5
  • dbt: < 1.8 (tested 1.8, 1.9, 1.10)

Additional context Related DBT issue: https://github.com/dbt-labs/dbt-core/issues/12303

DmytryEmery avatar Dec 19 '25 18:12 DmytryEmery

Hi, I also share pain with this token limit. It would be great if this was something we could override with a parameter.

grainusrainus avatar Dec 19 '25 18:12 grainusrainus