Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2012

    Unanswered: converting Mysql insert query into Postgresql query

    Hi guys!
    I'm migrating my mysql databases into postgresql database. While converting my python script I'm getting error exactly in these query. Could you please help me to solve this issue.

    query = """insert into searches (fid, from_id, from_name, keyword, type, link, posted, message, story, likes, comments, shares, harvested, run_id)
                        values ('"""+str(fid)+"""', '"""+str(from_id)+"""', '"""+str(from_name)+"""', '"""+str(keyword)+"""', '"""+str(fbtype)+"""', '"""+str(link)+"""',cast('"""+str(createdtime).replace('+0000','')+"""' as datetime), '"""+str(fbmessage)+"""', '"""+str(fbstory)+"""', '"""+str(fblikes)+"""', '"""+str(fbcomments)+"""', '"""+str(fbshares)+"""', now(), '"""+str(run_id)+"""')"""

  2. #2
    Join Date
    Nov 2003
    Provided Answers: 8
    You need to do two things_

    1) show us the exact error message
    2) show us the generated SQL - I bet you'll see the error yourself then.
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags:

    Tips for good questions:

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts