diff --git a/pymysql/connections.py b/pymysql/connections.py index f571915..68ec2e5 100644 --- a/pymysql/connections.py +++ b/pymysql/connections.py @@ -569,6 +569,7 @@ class Connection(object): autocommit: Autocommit mode. None means use server default. (default: False) local_infile: Boolean to enable the use of LOAD DATA LOCAL command. (default: False) max_allowed_packet: Max size of packet sent to server in bytes. (default: 16MB) + Only used to limit size of "LOAD LOCAL INFILE" data packet smaller than default (16KB). defer_connect: Don't explicitly connect on contruction - wait for connect call. (default: False) auth_plugin_map: A dict of plugin names to a class that processes that plugin. @@ -676,7 +677,7 @@ class Connection(object): self.socket = None else: self.connect() - + def _create_ssl_ctx(self, sslp): if isinstance(sslp, ssl.SSLContext): return sslp @@ -1027,26 +1028,25 @@ class Connection(object): if isinstance(sql, text_type): sql = sql.encode(self.encoding) - # +1 is for command - chunk_size = min(self.max_allowed_packet, len(sql) + 1) + packet_size = min(MAX_PACKET_LEN, len(sql) + 1) # +1 is for command # tiny optimization: build first packet manually instead of # calling self..write_packet() - prelude = struct.pack('