{"id":17053732,"url":"https://github.com/relrin/sanic-pw","last_synced_at":"2025-04-12T16:45:53.394Z","repository":{"id":57463856,"uuid":"121424573","full_name":"Relrin/sanic-pw","owner":"Relrin","description":"Peewee ORM integration for Sanic framework","archived":false,"fork":false,"pushed_at":"2018-10-02T08:28:24.000Z","size":16,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-18T09:40:54.890Z","etag":null,"topics":["orm","peewee","python","sanic"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Relrin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-13T19:11:30.000Z","updated_at":"2021-01-27T04:03:03.000Z","dependencies_parsed_at":"2022-09-05T05:30:12.077Z","dependency_job_id":null,"html_url":"https://github.com/Relrin/sanic-pw","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Relrin%2Fsanic-pw","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Relrin%2Fsanic-pw/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Relrin%2Fsanic-pw/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Relrin%2Fsanic-pw/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Relrin","download_url":"https://codeload.github.com/Relrin/sanic-pw/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239952606,"owners_count":19723922,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["orm","peewee","python","sanic"],"created_at":"2024-10-14T10:13:05.145Z","updated_at":"2025-02-21T19:30:34.692Z","avatar_url":"https://github.com/Relrin.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sanic-PW\n\nA port of the [Flask-PW](https://github.com/klen/flask-pw) package for [Sanic framework](https://github.com/channelcat/sanic).\n\n# Features\n- Configuring Peewee ORM like in Flask with SQLAlchemy\n- Migrate commands (create, rollback, etc.) via:\n    - using commands as a part of Sanic-Script\n    - click CLI\n- Pre- and post-signals support for saving and deleting\n\n# Requirements\n- Python 3.6+ (older not tested)\n\n# Dependency note\nFor using the 2nd version of Peewee ORM, please use `sanic-pw==0.1.0`.\n\n# Using\n## Installing\nFor installing Sanic-PW use the following command:\n```\npip install sanic-pw\n```\n\n## List of available settings\n| Config parameter | Description |  Default value |\n|------------------|-------------|----------------|\n| PEEWEE_DATABASE_URI      | A connection URI                                        | `'sqlite:///peewee.sqlite'`  |\n| PEEWEE_CONNECTION_PARAMS | Connection parameters for Peewee ORM                    | `{}`                         |\n| PEEWEE_MIGRATE_DIR       | Path to directory with migrations                       | `'migrations'`               |\n| PEEWEE_MIGRATE_TABLE     | Name of database table with migrations                  | `'migratehistory'`           | \n| PEEWEE_MODELS_MODULE     | Path to module which contains you applications' Models  | `''`                         |\n| PEEWEE_MODELS_IGNORE     | Models which should be ignored in migrations            | `[]`                         |\n| PEEWEE_MODELS_CLASS      | Base models class                                       | `\u003csanic_pw.Model\u003e`           |            \n| PEEWEE_MANUAL            | Don't connect to db when request starts and close when it ends automatically | `False` |     \n| PEEWEE_USE_READ_SLAVES   | Use database slaves for reading data when coming `SELECT ...` queries        | `True`  |    \n| PEEWEE_READ_SLAVES       | A list of nodes which can be used for reading                                | `[]`    |    \n\n## Migrations\nIf you're using the Sanic-Script package, then append a new command to your manager:\n```python\nfrom sanic_pw import Peewee\n\n# ...\napp.db = Peewee(app)\n\nmanager = Manager(app)\nmanager.add_command('db', app.db.manager)\n```\nFor a case when you're prefer to use click it almost the same:\n```python\nfrom sanic_pw import Peewee\n\n# ...\napp.db = Peewee(app)\napp.db.cli() \n```\nAfter it, you can use database `create`, `migrate` or `rollback` commands.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frelrin%2Fsanic-pw","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frelrin%2Fsanic-pw","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frelrin%2Fsanic-pw/lists"}