Hi All,

A noob question, that I've been struggling with off and on for a while. I'm 
pretty sure that I'm missing something obvious...

I'm creating tables and their entries "on the fly" programmatically, and 
need to control the table names. 

I understand how to define declarative classes as follows:
Base = declarative_base()
levels_name = "foobar"
class Level(Base):
    __tablename__ = levels_name
    height = Column(Float)
That works well when the static string "foobar" is in the class definition 
module.

What I can't figure out is how to name a table at "construction time" with 
a dynamic string. In other words, how do I specify a tablename when I first 
_use_  a declarative class?

A perfect scenario for me would be something like:
Base = declarative_base()
class Level(Base):
    height = Column(Float)

lvl = Level.set_tablename('foobar')

lvl.height = 100.

and have that show up in a table 'foobar', but I can't figure out any way 
to code set_tablename() ...

In case it matters, my backend is Postgres 9.4.0.1 ...

What am I missing?

TIA for any advice!

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to