psycopg2 doesn't support :named parameters. The Python DB-API spec allows for :named parameters with paramstyle = 'named', but psycopg2 uses:
>>> import psycopg2
>>> psycopg2.paramstyle
'pyformat'
as documented in the psycopg2 docs.
It's a pity that Python's DB-API allows a variety of parameter styles, but that's how it is. Some drivers appear to support changing paramstyle as a DB-API extension. But it doesn't look like psycopg2 is one of them:
>>> psycopg2.paramstyle = 'named'
>>> psycopg2.paramstyle
'named'
>>> cur.execute("SELECT :a, :b, :c", {'a': 1, 'b': 2, 'c': 3})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
psycopg2.ProgrammingError: syntax error at or near ":"
LINE 1: SELECT :a, :b, :c
>>> conn.rollback()
>>> cur.execute("SELECT %(a)s, %(b)s, %(c)s", {'a': 1, 'b': 2, 'c': 3})
>>>
So if you've seen :param style parameters work before, it's because some outer layer (maybe SQLAlchemy) is adapting your queries for you. A quick look at the SQLAlchemy docs suggests that it may do just that.
At a guess, you're bypassing the SQLAlchemy dialect layer with your current code. But I don't really know SQLAlchemy...
psycopg2. Also what are you trying to do by setting a table name to something else?