peewee Documentation
Release 3.3.0Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 1.6 Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . on=(cte.c.recommender == Member.memid)) .with_cte(cte) .order_by(Member.memid.desc()) .bind(db)) 1.6 Database The Peewee Database object represents a connection to a database. The Database class is instantiated register hstore extension). db = PostgresqlExtDatabase('my_app', user='postgres', register_hstore=True) 1.6. Database 39 peewee Documentation, Release 3.3.0 For more information on database extensions, see:0 码力 | 280 页 | 1.02 MB | 1 年前3
peewee Documentation
Release 3.4.0Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 1.6 Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Member.surname) .join(Member, on=(cte.c.recommender == Member.memid)) .order_by(Member.memid.desc())) 1.6 Database The Peewee Database object represents a connection to a database. The Database class is instantiated db', regexp_function=True, timeout=3, pragmas=(('journal_mode', 'wal'),)) (continues on next page) 1.6. Database 39 peewee Documentation, Release 3.4.0 (continued from previous page) from playhouse.postgres_ext0 码力 | 284 页 | 1.03 MB | 1 年前3
peewee Documentation
Release 2.10.2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 1.6 Managing your Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . take a bit to get to them. • Ask on the mailing list, https://groups.google.com/group/peewee-orm 1.6 Managing your Database This document describes how to perform typical database-related tasks with Postgresql database""" class Meta: database = psql_db class User(BaseModel): username = CharField() 1.6. Managing your Database 19 peewee Documentation, Release 2.10.2 The Playhouse, extensions to Peewee0 码力 | 221 页 | 844.06 KB | 1 年前3
peewee Documentation
Release 3.6.0. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 1.6 Models and Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . so, please leave a comment on this GitHub issue: https://github.com/coleifer/peewee/issues/1640 1.6 Models and Fields Model classes, Field instances and model instances all map to database concepts: ForeignKeyField, which allows you to represent foreign-key relationships between models in an intuitive way: 1.6. Models and Fields 43 peewee Documentation, Release 3.6.0 class Message(Model): user = ForeignKeyField(User0 码力 | 302 页 | 1.02 MB | 1 年前3
peewee Documentation
Release 3.5.0. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 1.6 Models and Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . db class Blog(BaseModel): title = CharField() contents = TextField() pub_date = DateTimeField() 1.6 Models and Fields Model classes, Field instances and model instances all map to database concepts: = DateTimeField(default=datetime.datetime.now) This allows you to write code like the following: 1.6. Models and Fields 43 peewee Documentation, Release 3.5.0 >>> print(some_message.user.username) Some0 码力 | 282 页 | 1.02 MB | 1 年前3
peewee Documentation
Release 0.9.7(smells like django) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 1.6 Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . classmethod table_exists() Return type Boolean whether the table for this model exists in the database 1.6 Fields The Field class is used to describe the mapping of Model attributes to database columns. Each message in some_user.messages: ... print message.body some message another message yet another message 1.6. Fields 25 peewee Documentation, Release 0.9.7 1.6.1 Field types table Parameters accepted by all0 码力 | 53 页 | 347.03 KB | 1 年前3
peewee Documentation
Release 2.0.2provides a django-like Admin interface, RESTful API, Authentication and more for your peewee models. 1.6 Model API (smells like django) Models and their fields map directly to database tables and columns Creating models in the interactive interpreter is a snap. 1. Use the Model.create() classmethod: 1.6. Model API (smells like django) 25 peewee Documentation, Release 2.0.0 >>> user = User.create(username=’charlie’) If force_insert=True an INSERT will be issued regardless of whether or not the primary key exists. 1.6. Model API (smells like django) 27 peewee Documentation, Release 2.0.0 example: >>> some_obj.title0 码力 | 65 页 | 315.33 KB | 1 年前3
peewee Documentation
Release 1.0.0classmethod table_exists() Return type Boolean whether the table for this model exists in the database 1.6 Fields The Field class is used to describe the mapping of Model attributes to database columns. Each auto_round, rounding PrimaryKeyField column_class ForeignKeyField to, related_name, cascade, extra 1.6. Fields 27 peewee Documentation, Release 1.0.0 A note on validation Both default and choices could python_value(value) Parameters value – data coming from the backend storage Return type python data type 1.6. Fields 29 peewee Documentation, Release 1.0.0 lookup_value(lookup_type, value) Parameters • lookup_type0 码力 | 71 页 | 405.29 KB | 1 年前3
共 8 条
- 1













