Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8422869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:34:34+00:00 2026-06-10T03:34:34+00:00

The following code does not elicit an error. But it doesn’t put any values

  • 0

The following code does not elicit an error. But it doesn’t put any values in my database either. Have taken all constraints off the table except index on Primary Key. The two fields are both strings. Any ideas? The most confusing thing is that no errors get logged.

conn = psycopg2.connect("dbname=<mydbname> user=postgres password=<mypassword>")
cur = conn.cursor()
output = StringIO.StringIO()
output.write('Citizen Caine\tMy_API_id\n')
cur.copy_from(output, 'movie', columns=('title','api_id'))
conn.commit()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T03:34:36+00:00Added an answer on June 10, 2026 at 3:34 am

    I struggled with this one too. Some hidden knowledge is that you have to do an:

    output.seek(0) #put the position of the buffer at the beginning
    

    after your write, or if you’re moving from database to database, after you do a copy_to.

    It’s easy to forget that StringIO objects have all the same methods and attributes of a file object.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following code does not have any errors when run script.py -f filename but
The following code does not yield any invalid values even though I am filling
The following code does not want to compile. See the included error message. Code:
The following code does not compile, saying error C2248: 'A::getMe' : cannot access private
The following code does not submit the input values: $('.button').live('click', function() { var date
The following code does not compile with gcc 4.7 (20120114) , but compiles fine
The following code does not compile. I get an error message: error C2039: 'Asub'
The following code does not work correctly on Windows (but does on Linux): sock
How come the following code does not cause any fade effects? var currentTicker =0;
Any ideas why the following code does not exit the Outlook 2007 process created

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.