Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When generator client output is set, prisma db push fails with Permission Denied #917

Open
ethanabrooks opened this issue Feb 23, 2024 · 0 comments

Comments

@ethanabrooks
Copy link

ethanabrooks commented Feb 23, 2024

Bug description

This is my schema:

generator client {
  provider = "prisma-client-py"
  output   = "generated"
}

datasource db {
  provider = "sqlite"
  url      = "file:./dev.db"
}

model User {
  id    Int     @id @default(autoincrement())
  email String  @unique
  name  String?
}

I get:

❯ prisma db push
Prisma schema loaded from prisma/schema.prisma
Datasource "db": SQLite database "dev.db" at "file:./dev.db"

🚀  Your database is now in sync with your Prisma schema. Done in 35ms

Running generate... - Prisma Client Python (v0.12.0)

Some types are disabled by default due to being incompatible with Mypy, it is highly recommended
to use Pyright instead and configure Prisma Python to use recursive types. To re-enable certain types:

generator client {
  provider             = "prisma-client-py"
  recursive_type_depth = -1
}

If you need to use Mypy, you can also disable this message by explicitly setting the default value:

generator client {
  provider             = "prisma-client-py"
  recursive_type_depth = 5
}

For more information see: https://prisma-client-py.readthedocs.io/en/stable/reference/limitations/#default-type-limitations

Traceback (most recent call last):
  File "/nix/store/s16v3cd2dzg07kjpp7bchb8wp69mwjrv-python3.11-prisma-0.12.0/lib/python3.11/site-pac
kages/prisma/generator/generator.py", line 108, in run
    self._on_request(request)
  File "/nix/store/s16v3cd2dzg07kjpp7bchb8wp69mwjrv-python3.11-prisma-0.12.0/lib/python3.11/site-pac
kages/prisma/generator/generator.py", line 161, in _on_request
    self.generate(data)
  File "/nix/store/s16v3cd2dzg07kjpp7bchb8wp69mwjrv-python3.11-prisma-0.12.0/lib/python3.11/site-pac
kages/prisma/generator/generator.py", line 234, in generate
    copy_tree(BASE_PACKAGE_DIR, rootdir)
  File "/nix/store/s16v3cd2dzg07kjpp7bchb8wp69mwjrv-python3.11-prisma-0.12.0/lib/python3.11/site-pac
kages/prisma/generator/utils.py", line 113, in copy_tree
    shutil.copytree(
  File "/nix/store/pwr22740f2pv36q5g28l1gjdg1bw43zm-python3-3.11.7/lib/python3.11/shutil.py", line 5
61, in copytree
    return _copytree(entries=entries, src=src, dst=dst, symlinks=symlinks,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/pwr22740f2pv36q5g28l1gjdg1bw43zm-python3-3.11.7/lib/python3.11/shutil.py", line 5
15, in _copytree
    raise Error(errors)

The output is quite large so I am posting only the abridged version. Here is the full version: https://gist.github.com/ethanabrooks/8c7d93c3ba92d48eec4a79eed25ff529

Environment & setup

  • OS:
❯ sw_vers                
ProductName:            macOS
ProductVersion:         14.3.1
BuildVersion:           23D60
  • Database: SQLite
  • Python version:
  • Prisma version:
    ❯ python --version
    Python 3.11.7
❯ prisma py version
prisma                  : 5.8.0
prisma client python    : 0.12.0
platform                : darwin
expected engine version : 0a83d8541752d7582de2ebc1ece46519ce72a848
installed extras        : []
install path            : /nix/store/s16v3cd2dzg07kjpp7bchb8wp69mwjrv-python3.11-prisma-0.12.0/lib/python3.11/site-packages/prisma
binary cache dir        : /Users/ethan/.cache/prisma-python/binaries/5.8.0/0a83d8541752d7582de2ebc1ece46519ce72a848

Important to note: I am using nix, which has a read-only store where (among other things) python dependencies are saved. I suspect that prisma is copying files from this store which results in them being write only. If this is the case, we can hopefully brainstorm some solutions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant