{"id":19210011,"url":"https://github.com/zencodex/scrapy-orator","last_synced_at":"2026-06-17T20:35:03.784Z","repository":{"id":76097211,"uuid":"197693326","full_name":"zencodex/scrapy-orator","owner":"zencodex","description":"scrapy integrate orator","archived":false,"fork":false,"pushed_at":"2019-07-19T03:12:16.000Z","size":6,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-02-23T07:27:38.603Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zencodex.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-19T03:11:38.000Z","updated_at":"2024-02-20T03:28:06.000Z","dependencies_parsed_at":"2023-03-03T02:45:59.150Z","dependency_job_id":null,"html_url":"https://github.com/zencodex/scrapy-orator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zencodex/scrapy-orator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zencodex%2Fscrapy-orator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zencodex%2Fscrapy-orator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zencodex%2Fscrapy-orator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zencodex%2Fscrapy-orator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zencodex","download_url":"https://codeload.github.com/zencodex/scrapy-orator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zencodex%2Fscrapy-orator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34465321,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-17T02:00:05.408Z","response_time":127,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-09T13:33:55.003Z","updated_at":"2026-06-17T20:35:03.757Z","avatar_url":"https://github.com/zencodex.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## scrapy 如何整合 orator\n\norator 是 python 的 ORM 数据库操作框架。\n数据库初始化代码在 `models/__init__.py` 中，建立关联的代码如下：\n\n```py\nimport os\nimport yaml\nfrom orator import DatabaseManager, Model\nfrom pathlib import Path\n\n__config = str(Path(os.path.realpath(__file__)).parents[1]) + '/orator.yml'\ndb = DatabaseManager(yaml.load(open(__config))['databases'])\n\nModel.set_connection_resolver(db)\n```\n\n这么做的好处是，spider 里面引入 model 时，直接使用：\n\n  from models.noi2018_award import Noi2018Award\n\n`models/__init__.py` 会自动调用，这样数据库配置管理就自动完成了\n\n## orator.yml 配置\n\n```\ndatabases:\n  pgsql:\n    driver: pgsql\n    database: 100kwhy\n    user: postgres\n    password: ''\n    prefix: ''\n```\n\n新建 model 命令：\n\n  orator make:model table_name -m\n\n## orator 常用命令\n\n```sh\nUsage:\n  command [options] [arguments]\n\nOptions:\n  -h, --help                      Display this help message\n  -q, --quiet                     Do not output any message\n  -V, --version                   Display this application version\n      --ansi                      Force ANSI output\n      --no-ansi                   Disable ANSI output\n  -n, --no-interaction            Do not ask any interactive question\n  -v|vv|vvv, --verbose[=VERBOSE]  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug\n\nAvailable commands:\n  help              Displays help for a command\n  list              Lists commands\n  migrate           Run the database migrations.\n db\n  db:seed           Seed the database with records.\n make\n  make:migration    Create a new migration file.\n  make:model        Creates a new Model class.\n  make:seed         Create a new seeder file.\n migrate\n  migrate:install   Create the migration repository.\n  migrate:refresh   Reset and re-run all migrations.\n  migrate:reset     Rollback all database migrations.\n  migrate:rollback  Rollback the last database migration.\n  migrate:status    Show a list of migrations up/down.\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzencodex%2Fscrapy-orator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzencodex%2Fscrapy-orator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzencodex%2Fscrapy-orator/lists"}