The superclass Object can be bound to database or not?

Or you can bind only a subset of the superclass? And what types of data,in addition to the database can be mapped superclass or a subclass.
July 2nd 19 at 13:16
1 answer
July 2nd 19 at 13:18
Solution
  1. What do you mean by "bind to database"? Which ORM is used?
  2. What do you mean "a subclass of the superclass"? Oil oil.
  3. Why do you call a DB data type?
  4. How do you understand the reference class to a data type?


Please explain the essence of the question in human terms, and not by means of incorrectly used terms.
I want to write one DB class which will be the connection and methods to work with ALL tables, so for example that method I could request as users in the users table and product.. - alyson_Cummings commented on July 2nd 19 at 13:21
Peewee - alyson_Cummings commented on July 2nd 19 at 13:24
1) I tried Peewee, and if I am anything it is not confusing - I was under the impression that this is an experimental and very peculiar ORM with a very crafty syntax based on introspection. Assuming you are a novice developer you should look at SQLAlchemy, or Django ORM with it, which is simple as a nail.
2) Write a single class, representing all entities of the database - is extremely impractical. You lose all the advantages of the OOP approach in principle.
You class is in principle not necessary then you can distribute a bunch of functions in the module
Class/module this will be a huge
- Inheritance is useless if you have only one class
- Have the sea of code duplication
Division of entities into classes was not invented in vain. Each class ORM focuses on any entity subject area, and thus between the subject area and the structure of the database there is a correspondence.
The main question - why? What problem you want to solve and why you so complicated? - Leann39 commented on July 2nd 19 at 13:27
: so I asked in the beginning about classes and inheritance. The entity database is a function of the class? For example,I need to create a database of different products. One class will have a relationship to the products group and it will inherit the class, food,class supplies for children etc. You can do so? - alyson_Cummings commented on July 2nd 19 at 13:30
Not quite. You will have a class Product (say Product). It will be the type that will take different values, for example "children", "food", ... is the most practical in most cases. - Leann39 commented on July 2nd 19 at 13:33
Thank you for understand me. Then having class goods,as it appears in the database? What if 2 or more different classes? For example, Goods,Ads and a TV Program? - alyson_Cummings commented on July 2nd 19 at 13:36
Then you will have different tables: Product, Advertisement, Television. A different types of, say, goods is probably more convenient to Express the field of the Product table, as I wrote above. - Leann39 commented on July 2nd 19 at 13:39

Find more questions by tags Python