On 12/4/06, ml <[EMAIL PROTECTED]> wrote:
>
> Hi!
>
> I'm looking for something like Postgresql's "CREATE TABLE a ... LIKE b".
> Is there any similar construction in SA? I created a simple function
>
> def inherit_table(name, table, *args, **kwargs):
>     args = list(args)
>     for c in table.columns:
>         args.append(c.copy())
>     for c in table.constraints:
>         args.append(c.copy())
>
>     return Table(name, table._metadata, *args, **kwargs)
>
>
> but I is it clean?

Other than calling this "inherit_table" when it doesn't really have
much to do with inheritance (either the pg INHERITS or class
heirarchies), I think this is as good as you're going to get.

-- 
Jonathan Ellis
http://spyced.blogspot.com

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to