How to save/copy value of table column not listed in csv column list in vertica copy command
<p>I am using following code to copy data from csv to vertica table.</p>

<pre><code>copy_command = 'COPY cb.table_format2 (ACC_NO, REF_NO, CUSTOMER_NAME, ADDRESS) FROM STDIN '\
    'ENCLOSED BY \'"\' delimiter \',\' SKIP 1 '\
    'exceptions \'' + file_path_exception + '\' rejected data \'' + file_path_rejected + '\';'
with open(file_path, "rb") as inf:
            cur.copy(copy_command, inf)
</code></pre>

<p>I have another field named 'FileId' in vertica table and i want to populate it with value of my local variable, so that i can check later that which data is entered against which fileId, and in my future requirements, i also want to save created on date and user session id in other columns too. </p>

<p>Please let me know how can i do this? Either even this is possible or not?
If this can't be done then what are other ways to make sure which data is saved/copied against which time stamp and user session?</p>

<p>Thanks for help in advance.</p>

<p>Update:-
I am using python 3 and vertica_python module to connect to vertica from python.</p>

<p>You need to use <code>AS</code> to sql expressions to fields. You don't mention which python module you are using, but you can do it as a literal. Add in a new field entry that looks like: </p>

<pre><code>FILEID AS 123456
</code></pre>

<p>And just get your string to look that way (probably using a formatter, or a bind value). </p>

python vertica