title: Insert Python DuckDB table into SQL statement
body: <p>I am trying to use a registered virtual table as a table in a SQL statement using a connection to another database.  I can't just turn the column into a string and use that, I need the table/dataframe itself to work in the statement and join with the other tables in the SQL statment.  I'm trying this out on an Access database to start.  This is what I have so far:</p>
  <pre><code>import pyodbc
  import pandas as pd
  import duckdb
  conn = duckdb.connect()
  
  starterset = pd.read_excel (r'e:\Data Analytics\Python_Projects\Applications\DB_Test.xlsx')
  
  conn.register(&quot;test_starter&quot;, starterset)
  IDS = conn.execute(&quot;SELECT * FROM test_starter WHERE ProjectID &gt; 1&quot;).fetchdf()
  
  StartDate = '1/1/2015'
  EndDate = '12/1/2021'
  
  # establish the connection
  connt = pyodbc.connect(r'Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=E:\Databases\Offline.accdb;')
  cursor = conn.cursor()
  
  # Run the query
  query = (&quot;Select ProjectID, Revenue, ClosedDate from Projects INNER JOIN &quot; + IDS + &quot; Z on Z.ProjectID = Projects.ProjectID &quot;
  &quot;where ClosedDate between #&quot; + StartDate + &quot;# and #&quot; + EndDate + &quot;# AND Revenue &gt; 0 order by ClosedDate&quot;)
  sfd
  df = pd.read_sql(query, connt)
      
  df.to_excel(r'TEMP.xlsx', index=False)
  os.system(&quot;start EXCEL.EXE TEMP.xlsx&quot;)
  
  # Close the connection
  cursor.close()
  connt.close()
  </code></pre>
  <p>I have a list of IDs in the excel sheet that I'm trying to use as a filter from the database query.  Ultimately, this will form into several criteria from the same table: dates, revenue, and IDs among others.<br />
  Honestly, I'm surprised I'm having so much trouble doing this.  In SAS, with PROC SQL, it's so easy, but I can't get a dataframe to interface within the SQL parameters how I need it to.  Am I making a syntax mistake?<br />
  Most common error so far is &quot;UFuncTypeError: ufunc 'add' did not contain a loop with signature matching types (dtype('&lt;U55'), dtype('&lt;U55')) -&gt; dtype('&lt;U55')&quot;, but the types are the same.</p>