Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Answer

Commonmark migration
Source Link

I believe the issue is with cur.executemany(sql, flight_obs). The docs say:

executemany(sql, vars_list)

Execute a database operation (query or command) against all parameter tuples or mappings found in the sequence vars_list.

so it's effectively doing the equivalent of:

for i in flight_obs:
 cur.execute(sql, i)

Since flight_obs is a list of strings, not tuples/mappings, you end up with something like:

cur.execute(sql, '2016-07-01 16:42:21')
cur.execute(sql, 'A319')
cur.execute(sql, 'EDDB')

Simple fix - just replace cur.executemany with cur.execute and it should all work.

I believe the issue is with cur.executemany(sql, flight_obs). The docs say:

executemany(sql, vars_list)

Execute a database operation (query or command) against all parameter tuples or mappings found in the sequence vars_list.

so it's effectively doing the equivalent of:

for i in flight_obs:
 cur.execute(sql, i)

Since flight_obs is a list of strings, not tuples/mappings, you end up with something like:

cur.execute(sql, '2016-07-01 16:42:21')
cur.execute(sql, 'A319')
cur.execute(sql, 'EDDB')

Simple fix - just replace cur.executemany with cur.execute and it should all work.

I believe the issue is with cur.executemany(sql, flight_obs). The docs say:

executemany(sql, vars_list)

Execute a database operation (query or command) against all parameter tuples or mappings found in the sequence vars_list.

so it's effectively doing the equivalent of:

for i in flight_obs:
 cur.execute(sql, i)

Since flight_obs is a list of strings, not tuples/mappings, you end up with something like:

cur.execute(sql, '2016-07-01 16:42:21')
cur.execute(sql, 'A319')
cur.execute(sql, 'EDDB')

Simple fix - just replace cur.executemany with cur.execute and it should all work.

deleted 107 characters in body
Source Link
match
  • 11.2k
  • 3
  • 25
  • 46

I believe the issue is with cur.executemany(sql, flight_obs). theThe docs say:

executemany(sql, vars_list)

Execute a database operation (query or command) against all parameter tuples or mappings found in the sequence vars_list.

This implies that vars_list is a list of tuples of mappings, and that for each one, cur.execute will be called -so it's effectively doing the equivalent of:

for i in flight_obs:
 cur.execute(sql, i)

Since `flight_obsflight_obs is a list of strings, not tuples/mappingmappings, you end up with something like:

cur.execute(sql, '2016-07-01 16:42:21')
cur.execute(sql, 'A319')
cur.execute(sql, 'EDDB')

Simple fix - just replace cur.executemany with cur.execute and it should all work.

I believe the issue is with cur.executemany(sql, flight_obs). the docs say:

executemany(sql, vars_list)

Execute a database operation (query or command) against all parameter tuples or mappings found in the sequence vars_list.

This implies that vars_list is a list of tuples of mappings, and that for each one, cur.execute will be called - effectively doing the equivalent of:

for i in flight_obs:
 cur.execute(sql, i)

Since `flight_obs is a list of strings, not tuples/mapping, you end up with something like:

cur.execute(sql, '2016-07-01 16:42:21')
cur.execute(sql, 'A319')
cur.execute(sql, 'EDDB')

Simple fix - just replace cur.executemany with cur.execute and it should all work.

I believe the issue is with cur.executemany(sql, flight_obs). The docs say:

executemany(sql, vars_list)

Execute a database operation (query or command) against all parameter tuples or mappings found in the sequence vars_list.

so it's effectively doing the equivalent of:

for i in flight_obs:
 cur.execute(sql, i)

Since flight_obs is a list of strings, not tuples/mappings, you end up with something like:

cur.execute(sql, '2016-07-01 16:42:21')
cur.execute(sql, 'A319')
cur.execute(sql, 'EDDB')

Simple fix - just replace cur.executemany with cur.execute and it should all work.

Source Link
match
  • 11.2k
  • 3
  • 25
  • 46

I believe the issue is with cur.executemany(sql, flight_obs). the docs say:

executemany(sql, vars_list)

Execute a database operation (query or command) against all parameter tuples or mappings found in the sequence vars_list.

This implies that vars_list is a list of tuples of mappings, and that for each one, cur.execute will be called - effectively doing the equivalent of:

for i in flight_obs:
 cur.execute(sql, i)

Since `flight_obs is a list of strings, not tuples/mapping, you end up with something like:

cur.execute(sql, '2016-07-01 16:42:21')
cur.execute(sql, 'A319')
cur.execute(sql, 'EDDB')

Simple fix - just replace cur.executemany with cur.execute and it should all work.

default

AltStyle によって変換されたページ (->オリジナル) /