Query format with f-string
<p>I have very big dictionary that I want to insert into MySQL table. The dictionary keys are the column names in the table. I'm constructing my query like this as of now:</p>

<pre><code>bigd = {'k1':'v1', 'k2':10}
cols = str(bigd.keys()).strip('[]')
vals = str(bigd.values()).strip('[]')
query = "INSERT INTO table ({}) values ({})".format(cols,vals)
print query
</code></pre>

<p>Output:</p>

<pre><code>"INSERT INTO table ('k2', 'k1') values (10, 'v1')"
</code></pre>

<p>And this works in Python2.7</p>

<p>But in Python 3.6 if I use string literals like this:</p>

<pre><code>query = f"INSERT INTO table ({cols}) values ({vals})"
print(query)
</code></pre>

<p>It prints this:</p>

<pre><code>"INSERT INTO table (dict_keys(['k1', 'k2'])) values (dict_values(['v1', 10]))"
</code></pre>

<p>Any tips?</p>