Import python venv for stability
This commit is contained in:
+1
@@ -0,0 +1 @@
|
||||
pip
|
||||
+160
@@ -0,0 +1,160 @@
|
||||
Metadata-Version: 2.4
|
||||
Name: peewee
|
||||
Version: 3.19.0
|
||||
Summary: a little orm
|
||||
Author-email: Charles Leifer <coleifer@gmail.com>
|
||||
Project-URL: Repository, https://github.com/coleifer/peewee
|
||||
Project-URL: Documentation, https://docs.peewee-orm.com/
|
||||
Project-URL: Changelog, https://github.com/coleifer/peewee/blob/master/CHANGELOG.md
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Programming Language :: Python :: 2
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: Topic :: Database
|
||||
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
||||
Description-Content-Type: text/x-rst
|
||||
License-File: LICENSE
|
||||
Provides-Extra: mysql
|
||||
Requires-Dist: pymysql; extra == "mysql"
|
||||
Provides-Extra: postgres
|
||||
Requires-Dist: psycopg2-binary; extra == "postgres"
|
||||
Provides-Extra: psycopg3
|
||||
Requires-Dist: psycopg[binary]; extra == "psycopg3"
|
||||
Dynamic: license-file
|
||||
|
||||
.. image:: https://media.charlesleifer.com/blog/photos/peewee3-logo.png
|
||||
|
||||
peewee
|
||||
======
|
||||
|
||||
Peewee is a simple and small ORM. It has few (but expressive) concepts, making it easy to learn and intuitive to use.
|
||||
|
||||
* a small, expressive ORM
|
||||
* python 2.7+ and 3.4+
|
||||
* supports sqlite, mysql, mariadb, postgresql
|
||||
* tons of `extensions <http://docs.peewee-orm.com/en/latest/peewee/playhouse.html>`_
|
||||
|
||||
New to peewee? These may help:
|
||||
|
||||
* `Quickstart <http://docs.peewee-orm.com/en/latest/peewee/quickstart.html#quickstart>`_
|
||||
* `Example twitter app <http://docs.peewee-orm.com/en/latest/peewee/example.html>`_
|
||||
* `Using peewee interactively <http://docs.peewee-orm.com/en/latest/peewee/interactive.html>`_
|
||||
* `Models and fields <http://docs.peewee-orm.com/en/latest/peewee/models.html>`_
|
||||
* `Querying <http://docs.peewee-orm.com/en/latest/peewee/querying.html>`_
|
||||
* `Relationships and joins <http://docs.peewee-orm.com/en/latest/peewee/relationships.html>`_
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
Defining models is similar to Django or SQLAlchemy:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from peewee import *
|
||||
import datetime
|
||||
|
||||
|
||||
db = SqliteDatabase('my_database.db')
|
||||
|
||||
class BaseModel(Model):
|
||||
class Meta:
|
||||
database = db
|
||||
|
||||
class User(BaseModel):
|
||||
username = CharField(unique=True)
|
||||
|
||||
class Tweet(BaseModel):
|
||||
user = ForeignKeyField(User, backref='tweets')
|
||||
message = TextField()
|
||||
created_date = DateTimeField(default=datetime.datetime.now)
|
||||
is_published = BooleanField(default=True)
|
||||
|
||||
Connect to the database and create tables:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
db.connect()
|
||||
db.create_tables([User, Tweet])
|
||||
|
||||
Create a few rows:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
charlie = User.create(username='charlie')
|
||||
huey = User(username='huey')
|
||||
huey.save()
|
||||
|
||||
# No need to set `is_published` or `created_date` since they
|
||||
# will just use the default values we specified.
|
||||
Tweet.create(user=charlie, message='My first tweet')
|
||||
|
||||
Queries are expressive and composable:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# A simple query selecting a user.
|
||||
User.get(User.username == 'charlie')
|
||||
|
||||
# Get tweets created by one of several users.
|
||||
usernames = ['charlie', 'huey', 'mickey']
|
||||
users = User.select().where(User.username.in_(usernames))
|
||||
tweets = Tweet.select().where(Tweet.user.in_(users))
|
||||
|
||||
# We could accomplish the same using a JOIN:
|
||||
tweets = (Tweet
|
||||
.select()
|
||||
.join(User)
|
||||
.where(User.username.in_(usernames)))
|
||||
|
||||
# How many tweets were published today?
|
||||
tweets_today = (Tweet
|
||||
.select()
|
||||
.where(
|
||||
(Tweet.created_date >= datetime.date.today()) &
|
||||
(Tweet.is_published == True))
|
||||
.count())
|
||||
|
||||
# Paginate the user table and show me page 3 (users 41-60).
|
||||
User.select().order_by(User.username).paginate(3, 20)
|
||||
|
||||
# Order users by the number of tweets they've created:
|
||||
tweet_ct = fn.Count(Tweet.id)
|
||||
users = (User
|
||||
.select(User, tweet_ct.alias('ct'))
|
||||
.join(Tweet, JOIN.LEFT_OUTER)
|
||||
.group_by(User)
|
||||
.order_by(tweet_ct.desc()))
|
||||
|
||||
# Do an atomic update (for illustrative purposes only, imagine a simple
|
||||
# table for tracking a "count" associated with each URL). We don't want to
|
||||
# naively get the save in two separate steps since this is prone to race
|
||||
# conditions.
|
||||
Counter.update(count=Counter.count + 1).where(Counter.url == request.url)
|
||||
|
||||
Check out the `example twitter app <http://docs.peewee-orm.com/en/latest/peewee/example.html>`_.
|
||||
|
||||
Learning more
|
||||
-------------
|
||||
|
||||
Check the `documentation <http://docs.peewee-orm.com/>`_ for more examples.
|
||||
|
||||
Specific question? Come hang out in the #peewee channel on irc.libera.chat, or post to the mailing list, http://groups.google.com/group/peewee-orm . If you would like to report a bug, `create a new issue <https://github.com/coleifer/peewee/issues/new>`_ on GitHub.
|
||||
|
||||
Still want more info?
|
||||
---------------------
|
||||
|
||||
.. image:: https://media.charlesleifer.com/blog/photos/wat.jpg
|
||||
|
||||
I've written a number of blog posts about building applications and web-services with peewee (and usually Flask). If you'd like to see some real-life applications that use peewee, the following resources may be useful:
|
||||
|
||||
* `Building a note-taking app with Flask and Peewee <https://charlesleifer.com/blog/saturday-morning-hack-a-little-note-taking-app-with-flask/>`_ as well as `Part 2 <https://charlesleifer.com/blog/saturday-morning-hacks-revisiting-the-notes-app/>`_ and `Part 3 <https://charlesleifer.com/blog/saturday-morning-hacks-adding-full-text-search-to-the-flask-note-taking-app/>`_.
|
||||
* `Analytics web service built with Flask and Peewee <https://charlesleifer.com/blog/saturday-morning-hacks-building-an-analytics-app-with-flask/>`_.
|
||||
* `Personalized news digest (with a boolean query parser!) <https://charlesleifer.com/blog/saturday-morning-hack-personalized-news-digest-with-boolean-query-parser/>`_.
|
||||
* `Structuring Flask apps with Peewee <https://charlesleifer.com/blog/structuring-flask-apps-a-how-to-for-those-coming-from-django/>`_.
|
||||
* `Creating a lastpass clone with Flask and Peewee <https://charlesleifer.com/blog/creating-a-personal-password-manager/>`_.
|
||||
* `Creating a bookmarking web-service that takes screenshots of your bookmarks <https://charlesleifer.com/blog/building-bookmarking-service-python-and-phantomjs/>`_.
|
||||
* `Building a pastebin, wiki and a bookmarking service using Flask and Peewee <https://charlesleifer.com/blog/dont-sweat-small-stuff-use-flask-blueprints/>`_.
|
||||
* `Encrypted databases with Python and SQLCipher <https://charlesleifer.com/blog/encrypted-sqlite-databases-with-python-and-sqlcipher/>`_.
|
||||
* `Dear Diary: An Encrypted, Command-Line Diary with Peewee <https://charlesleifer.com/blog/dear-diary-an-encrypted-command-line-diary-with-python/>`_.
|
||||
* `Query Tree Structures in SQLite using Peewee and the Transitive Closure Extension <https://charlesleifer.com/blog/querying-tree-structures-in-sqlite-using-python-and-the-transitive-closure-extension/>`_.
|
||||
@@ -0,0 +1,66 @@
|
||||
../../../bin/pwiz,sha256=uAPLtPMGBMDnStxH2788gWmbuhuPrxJtdw8cSqKPUBg,261
|
||||
__pycache__/peewee.cpython-311.pyc,,
|
||||
__pycache__/pwiz.cpython-311.pyc,,
|
||||
peewee-3.19.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
peewee-3.19.0.dist-info/METADATA,sha256=1NHozBiUWKsUEy3I2HSsT6Oo6HeM2ktRultYq5b_ES0,7028
|
||||
peewee-3.19.0.dist-info/RECORD,,
|
||||
peewee-3.19.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
||||
peewee-3.19.0.dist-info/entry_points.txt,sha256=9Q8RyM6n1ok1hdrQjTpV-D4EFTR0tnRqesRyvLQYehQ,35
|
||||
peewee-3.19.0.dist-info/licenses/LICENSE,sha256=N0AJYSWwhzWiR7jdCM2C4LqYTTvr2SIdN4V2Y35SQNo,1058
|
||||
peewee-3.19.0.dist-info/top_level.txt,sha256=uV7RZ61bWm9zDrPVGNrGay4E4WDonEqtU2NPe5GGUWs,22
|
||||
peewee.py,sha256=PPIPqqSKqSyM9Nvsfdk0MCpnHI9F-KwInWF2s5oRsYA,282044
|
||||
playhouse/README.md,sha256=M1RalvmRWa8VsSh1J0Pj3KhaJUVSAjGcAB4RIzq2Tb8,3383
|
||||
playhouse/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
playhouse/__pycache__/__init__.cpython-311.pyc,,
|
||||
playhouse/__pycache__/apsw_ext.cpython-311.pyc,,
|
||||
playhouse/__pycache__/cockroachdb.cpython-311.pyc,,
|
||||
playhouse/__pycache__/dataset.cpython-311.pyc,,
|
||||
playhouse/__pycache__/db_url.cpython-311.pyc,,
|
||||
playhouse/__pycache__/fields.cpython-311.pyc,,
|
||||
playhouse/__pycache__/flask_utils.cpython-311.pyc,,
|
||||
playhouse/__pycache__/hybrid.cpython-311.pyc,,
|
||||
playhouse/__pycache__/kv.cpython-311.pyc,,
|
||||
playhouse/__pycache__/migrate.cpython-311.pyc,,
|
||||
playhouse/__pycache__/mysql_ext.cpython-311.pyc,,
|
||||
playhouse/__pycache__/pool.cpython-311.pyc,,
|
||||
playhouse/__pycache__/postgres_ext.cpython-311.pyc,,
|
||||
playhouse/__pycache__/psycopg3_ext.cpython-311.pyc,,
|
||||
playhouse/__pycache__/reflection.cpython-311.pyc,,
|
||||
playhouse/__pycache__/shortcuts.cpython-311.pyc,,
|
||||
playhouse/__pycache__/signals.cpython-311.pyc,,
|
||||
playhouse/__pycache__/sqlcipher_ext.cpython-311.pyc,,
|
||||
playhouse/__pycache__/sqlite_changelog.cpython-311.pyc,,
|
||||
playhouse/__pycache__/sqlite_ext.cpython-311.pyc,,
|
||||
playhouse/__pycache__/sqlite_udf.cpython-311.pyc,,
|
||||
playhouse/__pycache__/sqliteq.cpython-311.pyc,,
|
||||
playhouse/__pycache__/test_utils.cpython-311.pyc,,
|
||||
playhouse/_pysqlite/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
playhouse/_pysqlite/__pycache__/__init__.cpython-311.pyc,,
|
||||
playhouse/_pysqlite/cache.h,sha256=CW-Gw8vALOJCMqwIoWnPq9uX-7MqTqx7mDTEqWNVaVU,2331
|
||||
playhouse/_pysqlite/connection.h,sha256=efuthx844z1xPKzCbOCuaULy4thSKaRVYLx3l3DtXzs,4826
|
||||
playhouse/_pysqlite/module.h,sha256=qSrcPdiYifrdsi47qvCvSC1WOwQEjw81YA822SEn8Mk,2018
|
||||
playhouse/_sqlite_ext.c,sha256=g1sbFpwl2wS9Njsh4yRcoLW_M23oaNoG9RPHQbxSOsU,1519968
|
||||
playhouse/_sqlite_udf.c,sha256=0JN55FiOw1d9WqeJLjmqG6jqUIxs3UeJbuK2UuPiKuU,525946
|
||||
playhouse/apsw_ext.py,sha256=YltEYvR-nTiqUgXvvstKgj8ydeI7RnpNkJ0tF52nMto,5018
|
||||
playhouse/cockroachdb.py,sha256=Z183VMQKfBFtAcmLTWuNhPBt-q7zpqh1qR0cN345VYw,9169
|
||||
playhouse/dataset.py,sha256=SMi5y330jAXIgcHjcZ5RxcPAchLY1-NgPGZaZ9-rsF8,14832
|
||||
playhouse/db_url.py,sha256=hZJiUH6MKwhDw87gJb4Sa8I0l9WqVDbAGpOoJfQky2s,4540
|
||||
playhouse/fields.py,sha256=dyO8d3l-3uq_XP7gmQRVdL6k70oUfAiXGhCXjAbayeY,1699
|
||||
playhouse/flask_utils.py,sha256=Ou26hV7d5NLzm-3oq4dJArs1VUAWh8vDclyuHDNrfTI,8197
|
||||
playhouse/hybrid.py,sha256=rRAPBImP2x61DoYh53mLm4JMPoNCLPFTd7_WIrq6_gU,1528
|
||||
playhouse/kv.py,sha256=tAG__zzti3zM98PXMoPypUobJF6zgH_CBq3x2VgTxeU,5608
|
||||
playhouse/migrate.py,sha256=_cMwToxcO0IrNi5rzMWxAyESq_KDHfz-lHqGU0wPl7I,33453
|
||||
playhouse/mysql_ext.py,sha256=i2XwK2UDPVc9MMCfqGky27qqgQNvaTNJccZfTNlyYAE,3874
|
||||
playhouse/pool.py,sha256=JGsu9rYc5XUQwMHuQFzSH-BkNsMY99w5IViKGyC6okw,13092
|
||||
playhouse/postgres_ext.py,sha256=j6zThl6f86Tm5usrGmsTPDpclyOq53eLgfgDOo5Yy1s,15308
|
||||
playhouse/psycopg3_ext.py,sha256=dQMu3PQEi1NUk9YIWwpC_SbTNMlMoe2mjn9EvdG0DW8,5382
|
||||
playhouse/reflection.py,sha256=1gEnyVfkOOH_4jos9ItcOuilx-xCMOixukrzA5Bnkd0,31148
|
||||
playhouse/shortcuts.py,sha256=NB7Pc3SAZPD0lljn9Qx__bWk56O2EASB90TnRP5UxgE,12447
|
||||
playhouse/signals.py,sha256=FeHi7SxJ3ThG0tVes6M_x_K-wx93RhmsIqkSBy0YKkI,2511
|
||||
playhouse/sqlcipher_ext.py,sha256=ZO8zN6pM4_gA-5ML3P7cnlCop5aLU2w9JLFTktNznkU,3632
|
||||
playhouse/sqlite_changelog.py,sha256=c3FaYNZ-aWnDrZ9tgy9WxDRB6a8sFikDMajOzYmYeIQ,4793
|
||||
playhouse/sqlite_ext.py,sha256=3sEQ0MCRKPVNyTwMaX6m02d5QQcC5rHu_zQsBVpSb-Q,48525
|
||||
playhouse/sqlite_udf.py,sha256=wl356xkDKRq6rNPZOF2SPKm8UY4W1u7o1xGliqPeUQk,13665
|
||||
playhouse/sqliteq.py,sha256=aRLD7XR4AuLmV0C9p4oRItbDN8qwVTJ4dTw4vsOqIZs,10819
|
||||
playhouse/test_utils.py,sha256=AAxfQsWFmoPdaq-JW13tWnPbZBIiU8qLBWfWiQgLQ3A,1854
|
||||
pwiz.py,sha256=oVQhgMHTsFRx_gH-32omWtIpWjNQArXWEH930xrSu0o,8239
|
||||
@@ -0,0 +1,5 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: setuptools (80.9.0)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py3-none-any
|
||||
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
[console_scripts]
|
||||
pwiz = pwiz:main
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2010 Charles Leifer
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
peewee
|
||||
playhouse
|
||||
pwiz
|
||||
Reference in New Issue
Block a user