First my setup:
* Python 2.5
* MySQL 5.0.27-standard-log (MYISAM tables)
* MySQLdb.version_info (1, 2, 2, 'gamma', 1)
I have the following statement which I currently cursor.execute:
num_lines = cursor.execute("""insert into AAA (name,desc) select name,desc from BBB""")
The primary key in AAA is an auto_increment id.
The return is, of course, the number of lines which were inserted
and cursor.lastrowid evaluates to the firstid which was
created in AAA.
So, if after executing the statement above I get:
num_lines = 3
cursor.lastrowid = 5
Is there any guarantee that the id for all of my new rows will
be 5,6,7 ? Or could there have been a parallel insert happening
which would make the id for my 3 rows be not consecutive?
Thanks a lot in advance.
Zac
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Dear All,
First my setup:
* Python 2.5
* MySQL 5.0.27-standard-log (MYISAM tables)
* MySQLdb.version_info (1, 2, 2, 'gamma', 1)
I have the following statement which I currently cursor.execute:
num_lines = cursor.execute("""insert into AAA (name,desc) select name,desc from BBB""")
The primary key in AAA is an auto_increment
id
.The return is, of course, the number of lines which were inserted
and cursor.lastrowid evaluates to the first
id
which wascreated in AAA.
So, if after executing the statement above I get:
num_lines = 3
cursor.lastrowid = 5
Is there any guarantee that the
id
for all of my new rows willbe 5,6,7 ? Or could there have been a parallel insert happening
which would make the
id
for my 3 rows be not consecutive?Thanks a lot in advance.