INSERT Statement Truncation?
What: When making larger
text column insertions into the DB (using Kysely, the neon serverless driver, and kysely-neon dialect) I get errors that seem to be the result of my SQL statements being truncated.
Why: I am storing document embeddings for an LLM application.
How: I am using the Langchain Document model in conjunction with the Unstructured.io to clean and partition my document texts into a number of rows representing the full contents of a given document (PDF, docx, etc). The inserted rows consist of strings of text (possibly in the form of HTML tables), vector embeddings, and optional metadata. I am inserting these rows within a transaction using Kysely and the other technologies mentioned earlier.
Notably, when I chunk my insertions into multiple calls to the db, this problem no longer occurs, yet the limit on the number of rows I can insert without error seems relatively low (~10) all things considered. The text I'm inserting is not overly long (no more than 1000 characters) and the total size of the row is roughly equivalent to the following JSON (code samples and logs to follow):6 Replies
rival-blackOP•2y ago
Relevant application code:
unwilling-turquoise•2y ago
I am using neon to store scraped web pages as html in a
text field I only use the neon serverless driver and don't have this problem.
I just put one of my docs in a char counter one doc has up to 11,000 charsrival-blackOP•2y ago
Interesting... I can try again without the
kysely-neon dialect, though I'm loathe to move away from kysely in its entirety since we use it everywhere. Also I never had this issue when using AWS RDSmultiple-amethyst•2y ago
@Willem any luck reproducing with a different dialect? It would be good to know if this is on the Kysley or Neon side
rival-blackOP•2y ago
@ShinyPokemon Hey, just got finished looking through this – it's a Kysely issue (fixed in https://github.com/kysely-org/kysely/pull/202) thanks for the help!
multiple-amethyst•2y ago
Oooh, that's a nasty one. Thanks for letting us know!