peewee Documentation
Release 3.5.0charset alongside your other values: db = MySQLDatabase('database_name', user='www-data', charset='utf8mb4') Consult your database driver’s documentation for the available parameters: Postgres: psycopg2 html#some-mysql-examples] MySQL: pymysql [https://github.com/PyMySQL/PyMySQL/blob/f08f01fe8a59e8acfb5f5add4a8fe874bec2a196/pymysql/co nnections.py#L494-L513] SQLite: sqlite3 [https://docs.python.org/2/library/sqlite3 self.checksum = md5() def step(self, value): self.checksum.update(value.encode('utf-8')) def finalize(self): return self.checksum.hexdigest() # Usage: # The following computes0 码力 | 347 页 | 380.80 KB | 1 年前3
peewee Documentation Release 3.4.0charset alongside your other values: db = MySQLDatabase('database_name', user='www-data', charset='utf8mb4') Consult your database driver’s documentation for the available parameters: Postgres: psycopg2 html#some-mysql-examples] MySQL: pymysql [https://github.com/PyMySQL/PyMySQL/blob/f08f01fe8a59e8acfb5f5add4a8fe874bec2a196/pymysql/co nnections.py#L494-L513] SQLite: sqlite3 [https://docs.python.org/2/library/sqlite3 self.checksum = md5() def step(self, value): self.checksum.update(value.encode('utf-8')) def finalize(self): return self.checksum.hexdigest() # Usage: # The following computes0 码力 | 349 页 | 382.34 KB | 1 年前3
peewee Documentation
Release 3.5.0d1940 = date(1940, 1, 1) d1960 = date(1960, 1, 1) query = (Person .select() (continues on next page) 8 Chapter 1. Contents: peewee Documentation, Release 3.5.0 (continued from previous page) .where((Person charset alongside your other values: db = MySQLDatabase('database_name', user='www-data', charset='utf8mb4') Consult your database driver’s documentation for the available parameters: • Postgres: psycopg2 __init__(self): self.checksum = md5() def step(self, value): self.checksum.update(value.encode('utf-8')) def finalize(self): return self.checksum.hexdigest() # Usage: # The following computes an aggregate0 码力 | 282 页 | 1.02 MB | 1 年前3
peewee Documentation Release 3.6.0charset alongside your other values: db = MySQLDatabase('database_name', user='www-data', charset='utf8mb4') Consult your database driver’s documentation for the available parameters: Postgres: psycopg2 html#some-mysql-examples] MySQL: pymysql [https://github.com/PyMySQL/PyMySQL/blob/f08f01fe8a59e8acfb5f5add4a8fe874bec2a196/pymysql/co nnections.py#L494-L513] SQLite: sqlite3 [https://docs.python.org/2/library/sqlite3 self.checksum = md5() def step(self, value): self.checksum.update(value.encode('utf-8')) def finalize(self): return self.checksum.hexdigest() # Usage: # The following computes0 码力 | 377 页 | 399.12 KB | 1 年前3
peewee Documentation
Release 3.4.0d1940 = date(1940, 1, 1) d1960 = date(1960, 1, 1) query = (Person .select() (continues on next page) 8 Chapter 1. Contents: peewee Documentation, Release 3.4.0 (continued from previous page) .where((Person charset alongside your other values: db = MySQLDatabase('database_name', user='www-data', charset='utf8mb4') Consult your database driver’s documentation for the available parameters: • Postgres: psycopg2 __init__(self): self.checksum = md5() def step(self, value): self.checksum.update(value.encode('utf-8')) def finalize(self): return self.checksum.hexdigest() # Usage: # The following computes an aggregate0 码力 | 284 页 | 1.03 MB | 1 年前3
peewee Documentation
Release 3.6.0Let’s get all the people whose birthday was either: • before 1940 (grandma) • after 1959 (bob) 8 Chapter 1. Contents: peewee Documentation, Release 3.6.0 d1940 = date(1940, 1, 1) d1960 = date(1960 peewee Documentation, Release 3.6.0 db = MySQLDatabase('database_name', user='www-data', charset='utf8mb4') Consult your database driver’s documentation for the available parameters: • Postgres: psycopg2 __init__(self): self.checksum = md5() def step(self, value): self.checksum.update(value.encode('utf-8')) def finalize(self): return self.checksum.hexdigest() # Usage: # The following computes an aggregate0 码力 | 302 页 | 1.02 MB | 1 年前3
peewee Documentation
Release 3.3.0d1940 = date(1940, 1, 1) d1960 = date(1960, 1, 1) query = (Person .select() (continues on next page) 8 Chapter 1. Contents: peewee Documentation, Release 3.3.0 (continued from previous page) .where((Person charset alongside your other values: db = MySQLDatabase('database_name', user='www-data', charset='utf8mb4') Consult your database driver’s documentation for the available parameters: • Postgres: psycopg2 __init__(self): self.checksum = md5() def step(self, value): self.checksum.update(value.encode('utf-8')) def finalize(self): return self.checksum.hexdigest() # Usage: # The following computes an aggregate0 码力 | 280 页 | 1.02 MB | 1 年前3
peewee Documentation Release 3.1.0charset alongside your other values: db = MySQLDatabase('database_name', user='www-data', charset='utf8mb4') Consult your database driver’s documentation for the available parameters: Postgres: psycopg2 html#some-mysql-examples] MySQL: pymysql [https://github.com/PyMySQL/PyMySQL/blob/f08f01fe8a59e8acfb5f5add4a8fe874bec2a196/pymysql/co nnections.py#L494-L513] SQLite: sqlite3 [https://docs.python.org/2/library/sqlite3 self.checksum = md5() def step(self, value): self.checksum.update(value.encode('utf-8')) def finalize(self): return self.checksum.hexdigest() # Usage: # The following computes0 码力 | 332 页 | 370.77 KB | 1 年前3
peewee Documentation Release 3.0.0charset alongside your other values: db = MySQLDatabase('database_name', user='www-data', charset='utf8mb4') Consult your database driver’s documentation for the available parameters: Postgres: psycopg2 html#some-mysql-examples] MySQL: pymysql [https://github.com/PyMySQL/PyMySQL/blob/f08f01fe8a59e8acfb5f5add4a8fe874bec2a196/pymysql/co nnections.py#L494-L513] SQLite: sqlite3 [https://docs.python.org/2/library/sqlite3 self.checksum = md5() def step(self, value): self.checksum.update(value.encode('utf-8')) def finalize(self): return self.checksum.hexdigest() # Usage: # The following computes0 码力 | 319 页 | 361.50 KB | 1 年前3
peewee Documentation
Release 2.0.2CustomModel(Model): class Meta: database = custom_db class User(CustomModel): username = CharField() 8 Chapter 1. Contents: peewee Documentation, Release 2.0.0 class Tweet(CustomModel): # etc, etc Note: ’http://www.gravatar.com/avatar/%s?d=identicon&s=%d’ % \ (md5(self.email.strip().lower().encode(’utf-8’)).hexdigest(), size) # this model contains two foreign keys to user -- it essentially allows us to InsertQuery object at 0x7fc865beff10> >>> iq.execute() # <-- executes query and returns the new row’s PK 8 >>> sq = User.select().where(User.active == True) # <-- returns a SelectQuery >>> sq0 码力 | 65 页 | 315.33 KB | 1 年前3
共 16 条
- 1
- 2













