How to specify a dot separated table as a parameter into the sql query

For purposes of this question, let’s say there is a table schema

And we have created a cursor object using following boilerplate

import snowflake.connector

ctx = snowflake.connector.connect(...)
cur = ctx.cursor()

With that cursor object, we can put the whole dot deliminated schema into a query like so:

select * from

and have no issues, but we wouldn’t be able to do:

select * from %(tbl)s
''', {'tbl': ''} 

Doing that throws this type of error: ProgrammingError: 001011 (42601): SQL compilation error: invalid URL prefix found in:

I’m guessing this is because the dots are sql identifiers and not strings, but I don’t see any workaround in the snowflake documentation. Does anyone know how this could be done without having to change the connection object.


Using TABLE:

In a FROM clause, the syntax TABLE( { string_literal | session_variable | bind_variable } ) can be used

select * from TABLE(%(tbl)s)