{"id":16359701,"url":"https://github.com/jmsv/prisma-to-python","last_synced_at":"2026-06-29T07:31:36.642Z","repository":{"id":93148844,"uuid":"605298330","full_name":"jmsv/prisma-to-python","owner":"jmsv","description":"Parse prisma.schema files and output models as Python classes","archived":false,"fork":false,"pushed_at":"2023-04-15T00:58:35.000Z","size":51,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-08T02:42:39.509Z","etag":null,"topics":["prisma","python"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/prisma-to-python","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jmsv.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-22T21:37:24.000Z","updated_at":"2024-02-02T22:31:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"48e45c12-642d-4c05-a957-b1be2d54456a","html_url":"https://github.com/jmsv/prisma-to-python","commit_stats":{"total_commits":4,"total_committers":1,"mean_commits":4.0,"dds":0.0,"last_synced_commit":"708600dbfacf37d9237fe204866915da6d2b8cf1"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jmsv/prisma-to-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmsv%2Fprisma-to-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmsv%2Fprisma-to-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmsv%2Fprisma-to-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmsv%2Fprisma-to-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jmsv","download_url":"https://codeload.github.com/jmsv/prisma-to-python/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmsv%2Fprisma-to-python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34918101,"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-29T02:00:05.398Z","response_time":58,"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":["prisma","python"],"created_at":"2024-10-11T02:09:26.436Z","updated_at":"2026-06-29T07:31:36.625Z","avatar_url":"https://github.com/jmsv.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Prisma to Python\n\n[![npm version](https://badge.fury.io/js/prisma-to-python.svg)](https://badge.fury.io/js/prisma-to-python)\n\nParse prisma.schema files and output enums, types and models as Python classes.\n\n\u003e ⚠️ prisma-to-python only supports a subset of the prisma schema syntax - feel free to contribute any other features you need!\n\nThis was built to set up models for use with [pymongo](https://pypi.org/project/pymongo), but could be applicable to other use cases.\n\nprisma-to-python works by using the `getDMMF` function of [@prisma/internals](https://www.npmjs.com/package/@prisma/internals), which effectively parses the schema to an AST in JSON. This AST is then used to write Python code for the defined enums, types and models.\n\n## Usage\n\n```bash\nnpx prisma-to-python --input ./example/schema.prisma --output ./example/models.py\n```\n\n## Example\n\n### Input\n\n```prisma\n// https://pris.ly/d/prisma-schema\n\ngenerator client {\n  provider = \"prisma-client-js\"\n}\n\ndatasource db {\n  provider = \"mongodb\"\n  url      = env(\"DATABASE_URL\")\n}\n\nenum FruitName {\n  apple\n  banana\n  orange\n}\n\ntype Fruit {\n  fruit       FruitName\n  price       Int\n  description String?\n  dateSold    DateTime\n  received    Boolean\n}\n\nmodel FruitOrders {\n  id    String  @id @default(auto()) @map(\"_id\") @db.ObjectId\n  fruit Fruit[]\n}\n```\n\n### Output\n\n```python\n# Generated by prisma-to-python - https://github.com/jmsv/prisma-to-python#readme\n# Do not edit this file directly!\n\nfrom enum import Enum\nfrom typing import TypedDict, Optional\nfrom datetime import datetime\n\n# Enums\n\nclass FruitName(str, Enum):\n    APPLE = \"apple\"\n    BANANA = \"banana\"\n    ORANGE = \"orange\"\n\n# Types\n\nclass Fruit(TypedDict):\n    fruit: FruitName\n    price: int\n    description: Optional[str]\n    dateSold: datetime\n    received: bool\n\n# Models\n\nclass FruitOrders(TypedDict):\n    _id: str\n    fruit: list[Fruit]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmsv%2Fprisma-to-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjmsv%2Fprisma-to-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmsv%2Fprisma-to-python/lists"}