Copy data from csv file
<p>I am trying to follow one copy_from example describe in stackoverflow but i modify little as i need to read data from csv file. Following this example i wrote a small program where the file is to be readed from file stored in disk and then copy data from that file to created table, My code is :</p>

<pre><code>def importFile():
    path = "C:\myfile.csv"
    curs = conn.cursor()
    curs.execute("Drop table if exists test_copy; ")
    data = StringIO.StringIO()
    data.write(path)
    data.seek(0)
    curs.copy_from(data, 'MyTable')
    print("Data copied")
</code></pre>

<p>But i get error,</p>

<p>psycopg2.DataError: invalid input syntax for integer:</p>

<p>Does this mean there is mismatch between csv file and my table? OR is this syntax enough in order to copy csv file? or I need some more code ?? I am new to python, so any help will be appreciated..</p>
