peewee Documentation Release 2.10.2to another. Due to the unique index on from_user and to_user, we will be sure not to end up with duplicate rows: user = get_object_or_404(User, username=username) try: with database.transaction(): logic, typically one would rely on a unique constraint or primary key to prevent the creation of duplicate objects. As an example, let’s say we wish to implement registering a new user account using the username field, so we will rely on the database’s integrity guarantees to ensure we don’t end up with duplicate usernames: try: with db.atomic(): return User.create(username=username) except peewee0 码力 | 275 页 | 276.96 KB | 1 年前3
peewee Documentation
Release 2.10.2to another. Due to the unique index on from_user and to_user, we will be sure not to end up with duplicate rows: user = get_object_or_404(User, username=username) try: with database.transaction(): Relationship logic, typically one would rely on a unique constraint or primary key to prevent the creation of duplicate objects. As an example, let’s say we wish to implement registering a new user account using the username field, so we will rely on the database’s integrity guarantees to ensure we don’t end up with duplicate usernames: try: with db.atomic(): return User.create(username=username) except peewee.IntegrityError:0 码力 | 221 页 | 844.06 KB | 1 年前3
peewee Documentation Release 3.6.0to another. Due to the unique index on from_user and to_user, we will be sure not to end up with duplicate rows: user = get_object_or_404(User, username=username) try: with database.atomic(): wish to insert and ignore any potential constraint violation. MySQL supports upsert via the ON DUPLICATE KEY UPDATE clause. For example: class User(Model): username = TextField(unique=True) last_login The login count will be incremented atomically, the last login column will be updated, and no duplicate rows will be created. Postgresql and SQLite (3.24.0 and newer) provide a different syntax that0 码力 | 377 页 | 399.12 KB | 1 年前3
peewee Documentation
Release 3.6.0to another. Due to the unique index on from_user and to_user, we will be sure not to end up with duplicate rows: user = get_object_or_404(User, username=username) try: with database.atomic(): Relationship wish to insert and ignore any potential constraint violation. MySQL supports upsert via the ON DUPLICATE KEY UPDATE clause. For example: class User(Model): username = TextField(unique=True) last_login The login count will be incremented atomically, the last login column will be updated, and no duplicate rows will be created. Postgresql and SQLite (3.24.0 and newer) provide a different syntax that0 码力 | 302 页 | 1.02 MB | 1 年前3
peewee Documentation
Release 3.5.0to another. Due to the unique index on from_user and to_user, we will be sure not to end up with duplicate rows: user = get_object_or_404(User, username=username) try: with database.atomic(): The login count will be incremented atomically, the last login column will be updated, and no duplicate rows will be created. For more information, see Insert.on_conflict() and OnConflict. Deleting logic, typically one would rely on a unique constraint or primary key to prevent the creation of duplicate objects. As an example, let’s say we wish to implement registering a new user account using the0 码力 | 347 页 | 380.80 KB | 1 年前3
peewee Documentation Release 3.4.0to another. Due to the unique index on from_user and to_user, we will be sure not to end up with duplicate rows: user = get_object_or_404(User, username=username) try: with database.transaction(): output the name of the court, and the name of the member formatted as a single column. Ensure no duplicate data, and order by the member name. SELECT DISTINCT m.firstname || ' ' || m.surname AS member, The login count will be incremented atomically, the last login column will be updated, and no duplicate rows will be created. For more information, see Insert.on_conflict() and OnConflict. Deleting0 码力 | 349 页 | 382.34 KB | 1 年前3
peewee Documentation
Release 3.5.0to another. Due to the unique index on from_user and to_user, we will be sure not to end up with duplicate rows: user = get_object_or_404(User, username=username) try: with database.atomic(): Relationship The login count will be incremented atomically, the last login column will be updated, and no duplicate rows will be created. For more information, see Insert.on_conflict() and OnConflict. 1.7.5 Deleting logic, typically one would rely on a unique constraint or primary key to prevent the creation of duplicate objects. As an example, let’s say we wish to implement registering a new user account using the0 码力 | 282 页 | 1.02 MB | 1 年前3
peewee Documentation
Release 3.4.0to another. Due to the unique index on from_user and to_user, we will be sure not to end up with duplicate rows: user = get_object_or_404(User, username=username) try: with database.transaction(): Relationship output the name of the court, and the name of the member formatted as a single column. Ensure no duplicate data, and order by the member name. SELECT DISTINCT m.firstname || ' ' || m.surname AS member, The login count will be incremented atomically, the last login column will be updated, and no duplicate rows will be created. For more information, see Insert.on_conflict() and OnConflict. 1.8. Querying0 码力 | 284 页 | 1.03 MB | 1 年前3
peewee Documentation Release 3.0.0to another. Due to the unique index on from_user and to_user, we will be sure not to end up with duplicate rows: user = get_object_or_404(User, username=username) try: with database.transaction(): output the name of the court, and the name of the member formatted as a single column. Ensure no duplicate data, and order by the member name. SELECT DISTINCT m.firstname || ' ' || m.surname AS member, logic, typically one would rely on a unique constraint or primary key to prevent the creation of duplicate objects. As an example, let’s say we wish to implement registering a new user account using the0 码力 | 319 页 | 361.50 KB | 1 年前3
peewee Documentation Release 3.1.0to another. Due to the unique index on from_user and to_user, we will be sure not to end up with duplicate rows: user = get_object_or_404(User, username=username) try: with database.transaction(): output the name of the court, and the name of the member formatted as a single column. Ensure no duplicate data, and order by the member name. SELECT DISTINCT m.firstname || ' ' || m.surname AS member, logic, typically one would rely on a unique constraint or primary key to prevent the creation of duplicate objects. As an example, let’s say we wish to implement registering a new user account using the0 码力 | 332 页 | 370.77 KB | 1 年前3
共 11 条
- 1
- 2













