title: Is there a way to iterate through list and get row and column count of multiple Redshift tables using Python?
body: <p>I am trying to get row and column count for tables that are present in different schemas in <code>Redshift</code> using <code>Python</code>'s redshift_connector. I tried below code and receiving Programming Error that says. Not sure what is the issue ? Basically, I am trying to replace the shema and tables that are present in the list tables and get row count for the tables.</p>
  <pre><code>{'S: 'ERROR','C':123489, 'M' 'Syntax error at or near &quot;{&quot;&quot;,'P':'22....'L':714','R':'yyerror'}
  </code></pre>
  <p>Thanks in advance for your time and efforts!</p>
  <p><strong>Python Code:</strong></p>
  <pre><code>import redshift_connector
  
  tables=['schema1.tablename','schema2.table2']
  
  conn=redshift_connector.connect(
      host='my_host',
      port= &quot;my_port&quot;,
  database='my_db'
  user=&quot;user&quot;
  password='password')
  
  cur=conn.cursor()
  cur.execute ('select count(*) from {',' .join(&quot;'&quot;+y+&quot;'&quot; for y in tables)}')
  results=cur.fetchall()
  print(&quot;The table {} contained&quot;.format(tables[0]),*result[0],&quot;rows&quot;+&quot;\n&quot; ) #Printing row counts along with table names
  
  cur.close()
  conn.close()
  </code></pre>