Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #40197

Re: Largest possible size for executemany() in PEP-249 (Database API)

Date 2013-03-01 09:26 +1100
From Neil Hodgson <nhodgson@iinet.net.au>
Newsgroups comp.lang.python
Subject Re: Largest possible size for executemany() in PEP-249 (Database API)
References <kgo2oo$5tk$1@panix2.panix.com>
Message-ID <s6udndgPm6NtRLLMnZ2dnUVZ_tGdnZ2d@westnet.com.au> (permalink)

Show all headers | View raw


Roy Smith:

> _mysql_exceptions.OperationalError: (1153, "Got a packet bigger than
> 'max_allowed_packet' bytes")
>
> Is there any way (other than trial and error) to know how many records
> I can pass in one call before I blow up?

    Its unlikely to be a limit in the number of records but a limit on 
the number of bytes in the serialized command stream. With a deep 
understanding of the format you could count bytes until about to go over 
and then flush. I'd *guess* that the data is being sent as textual SQL 
INSERT statements so you could work out what your insertions look like 
as INSERT statements and see how many fit into max_allowed_packet. 
max_allowed_packet is probably 1 million so looking like 100 bytes per 
INSERT but will depend on data as inserting "Ko" should use less bytes 
than inserting "Naragarajan".

    Neil

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Largest possible size for executemany() in PEP-249 (Database API) roy@panix.com (Roy Smith) - 2013-02-28 12:05 -0500
  Re: Largest possible size for executemany() in PEP-249 (Database API) Neil Hodgson <nhodgson@iinet.net.au> - 2013-03-01 09:26 +1100
  Re: Largest possible size for executemany() in PEP-249 (Database API) Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-02-28 20:52 -0500

csiph-web