Re: psycopg2.DataError: invalid input syntax for integer: ""

2018-05-07 Thread tango ward
Hi All, Thanks for the suggestions. I managed to fix this by running CASE on the column. I also fix the %s to avoid SQLi as per discussed in the documentation of psycopg2. My apologies for consuming your time, it's my first time to work with DB and DB migration. Thanks, J On Mon, May 7, 2018 a

Re: psycopg2.DataError: invalid input syntax for integer: ""

2018-05-07 Thread Adrian Klaver
On 05/07/2018 12:28 AM, tango ward wrote: I think I've found the culprit of the problem. I have a field which is varchar from the source DB while on the destination DB its integer. Reading the documentation: http://www.postgresqltutorial.com/postgresql-cast/ but it gives me error `psycopg2.

Re: psycopg2.DataError: invalid input syntax for integer: ""

2018-05-07 Thread David G. Johnston
On Mon, May 7, 2018 at 6:35 AM, Adrian Klaver wrote: > >> Not sure but I'm thinking you at least need to add single >> quotes around the %s symbols. That doesn't really explain >> the integer input error though I'm not familiar with the >> exact fe

Re: psycopg2.DataError: invalid input syntax for integer: ""

2018-05-07 Thread Adrian Klaver
On 05/06/2018 11:05 PM, tango ward wrote: Yes, my apologies. May I also ask if there's a limitation for the number of timestamp with timezone fields in a table? On Mon, May 7, 2018 at 1:37 PM, David G. Johnston mailto:david.g.johns...@gmail.com>> wrote: Please keep replies on-list, don

Re: psycopg2.DataError: invalid input syntax for integer: ""

2018-05-07 Thread David G. Johnston
On Mon, May 7, 2018 at 12:28 AM, tango ward wrote: > I think I've found the culprit of the problem. > > I have a field which is varchar from the source DB while on the > destination DB its integer. > > Reading the documentation: http://www.postgresqltutorial. > com/postgresql-cast/ but it gives m

Re: psycopg2.DataError: invalid input syntax for integer: ""

2018-05-07 Thread tango ward
I think I've found the culprit of the problem. I have a field which is varchar from the source DB while on the destination DB its integer. Reading the documentation: http://www.postgresqltutorial.com/postgresql-cast/ but it gives me error `psycopg2.DataError: invalid input syntax for integer: ""`

Re: psycopg2.DataError: invalid input syntax for integer: ""

2018-05-06 Thread David G. Johnston
On Sunday, May 6, 2018, tango ward wrote: > Yes, my apologies. > > May I also ask if there's a limitation for the number of timestamp with > timezone fields in a table? > Not one that is likely to matter in practice. There's a page discussing limitations on the website/docs somewhere if you wis

Re: psycopg2.DataError: invalid input syntax for integer: ""

2018-05-06 Thread tango ward
Yes, my apologies. May I also ask if there's a limitation for the number of timestamp with timezone fields in a table? On Mon, May 7, 2018 at 1:37 PM, David G. Johnston < david.g.johns...@gmail.com> wrote: > Please keep replies on-list, don't top-post, and double-check that the > database table

Re: psycopg2.DataError: invalid input syntax for integer: ""

2018-05-06 Thread David G. Johnston
On Sunday, May 6, 2018, tango ward wrote: > cur_p.execute(""" > > INSERT INTO a_recipient (created, mod, agreed, address, > honor,) > VALUES (%s, %s)""", (current_timestamp, current_timestamp, > current_timestamp, '', '')) > > That code doesn't even run (extra co