Re: Creating database tables from queries based on ORM API?

Oleg Broytman <[email protected]> Tue, 16 Apr 2019 15:04:02 +0200
Newsgroups gmane.comp.python.sqlobject
Message-ID <[email protected]>
On Tue, Apr 16, 2019 at 02:57:14PM +0200, Markus Elfring <[email protected]> wrote:
> >    SQLObject supports 2 kinds of inheritance:
> 
> I am used to a stronger usage of inheritance for powerful software developments.

   Some classes in ORMs are of special kinds as they represent database
tables so inheritance must be used carefully for such classes.

> >    And of course classes can be simply inherited without creating SQL tables.
> 
> This is good to know.
> 
> But my clarification request should deal with intentional table creation
> for computation results from selected database queries.
> How can the specified table name be mapped to an additional Python object
> by an extended application programming interface?

    class MyTable(SQLObject):
        class sqlmeta:
            table = 'my_special_table_name'

   See http://sqlobject.org/SQLObject.html#class-sqlmeta

> Regards,
> Markus

Oleg.
-- 
    Oleg Broytman            https://phdru.name/            [email protected]
           Programmers don't die, they just GOSUB without RETURN.