prisma-client-py icon indicating copy to clipboard operation
prisma-client-py copied to clipboard

Incorrect naming convention on generated client

Open HiImJulien opened this issue 2 years ago • 0 comments

Bug description

Model names are not properly converted to snake_case according to python code styles. For example, a model "SnakeCase" should be accessible as "snake_case" in python using the prisma client.

How to reproduce

  1. Name a model consisting of two words (the same bug probably occurs when using more than two words). In my case OrganisationAffiliation.
  2. Run prisma generate
  3. Try to access the same model in python code. The model is exposed as prisma.organisationaffiliation instead of prisma.organisation_affiliation.

Expected behavior

Prisma information

model OrganisationAffiliation {
  userId         Int
  user           User         @relation(fields: [userId], references: [id])
  organisationId Int
  organisation   Organisation @relation(fields: [organisationId], references: [id])

  is_owner    Boolean @default(false)
  hourly_rate Float?

  @@unique([userId, organisationId], name: "affiliationId")
}

Environment & setup

  • OS: Alpine Linux (inside a Docker Container).
  • Database: Postgres
  • Python version: 3.11.2
  • Prisma version:
prisma                  : 4.10.1
prisma client python    : 0.8.1
platform                : linux-musl
expected engine version : aead147aa326ccb985dcfed5b065b4fdabd44b19
install path            : /usr/local/lib/python3.11/site-packages/prisma
installed extras        : []

HiImJulien avatar Mar 01 '23 17:03 HiImJulien