title: How to save to pre-existing Snowflake table from R using pool
body: <p>I am using <code>pool</code> to handle connections to my Snowflake warehouse. I have created a connection to my database and can read data in a pre-existing table with no issues e.g:</p>
  <pre><code>my_pool &lt;- dbPool(odbc::odbc(),
                 Driver       = &quot;Snowflake&quot;,
                 Server       = Sys.getenv('WH_URL'),
                 UID          = Sys.getenv('WH_USER'),
                 PWD          = Sys.getenv('WH_PW'),
                 Warehouse    = Sys.getenv('WH_WH'),
                 Database     = &quot;MY_DB&quot;)
  
  my_data&lt;-tbl(my_pool, in_schema(sql(&quot;schema_name&quot;), sql(&quot;table_name&quot;))) %&gt;% 
    collect() 
  </code></pre>
  <p>I would like to save back to a table (<code>table_name</code>) and I believe the best way to do this is with <code>pool::dbWriteTable</code>:</p>
  <pre><code># Create some data to save to db
  data&lt;-data.frame(&quot;user_email&quot; = &quot;tim@apple.com&quot;, 
          &quot;query_run&quot; = &quot;arrivals_departures&quot;, 
          &quot;data_downloaded&quot; = FALSE, 
          &quot;created_at&quot; = as.character(Sys.time()))
  
  # Define where to save the data
  table_id &lt;- Id(database=&quot;MY_DB&quot;, schema=&quot;MY_SCHEMA&quot;, table=&quot;TABLE_NAME&quot;)
  
  # Write to database 
  pool::dbWriteTable(my_pool, table_id, data, append=TRUE)
  </code></pre>
  <p>However this returns the error:</p>
  <blockquote>
  <p>Error in new_result(connection@ptr, statement, immediate) :
  nanodbc/nanodbc.cpp:1594: 00000: SQL compilation error:
  Object 'MY_DB.MY_SCHEMA.TABLE_NAME' already exists.</p>
  </blockquote>
  <p>I have read/write/update permissions for this database for the user specified in <code>my_pool</code>.</p>
  <p>I have explored the accepted answers <a href="https://stackoverflow.com/questions/62185369/how-to-write-an-r-data-frame-to-a-snowflake-database-table">here</a> and <a href="https://stackoverflow.com/questions/21568447/r-why-does-dbwritetable-fail-when-table-exists-despite-append-true">here</a> to create the above attempt and can't figure out what I'm doing wrong. It's probably something simple that I've forgotten to do - any thoughts?</p>
  <hr />
  <p>EDIT: Wondering if my issue is anything to do with: <a href="https://github.com/r-dbi/odbc/issues/480" rel="nofollow noreferrer">https://github.com/r-dbi/odbc/issues/480</a></p>