Skip to content

Feature request/Clarification on Prisma2 functionalities #950

Closed

Description

@shah05

Hi,

I'm currently creating an app that lets user connect to a particular database and read/extract info from the introspected columns. User should be able to select any/multiple columns from a table (from a DB) and then read the info.

Just facing some difficulties when automating the whole process to feed my GUI using Prisma2 and Photon API. Can you help with a few questions below ?

  1. Is there a way to introspect "JUST" a particular table in a DB ? Because, if let say I have a large database, then introspecting and generating the data model will take a significant time for user..
  2. Right now everytime I introspect a new DB, I have to copy the models or change the file name to "schema.prisma" before regenerating my Photon API. Is there a way to pass a flag to Prisma2 Introspection so that it use instead the generated datamodel file ? (to make the automation process more efficient).
  3. If let say I have 100 different databases, must I have 100 different node module folders each containing Photon API for each of the DB ? Is there a way to make it simpler.
  4. Is is possible to create general API in front of my "multiple" Photon APIs ? For example once I receive and API call from user, I have a general script that reads user info and points to the right Photon API and retrieve data accordingly ?

Sorry if its too long, but your thoughts/input are greatly appreciated. I'm kinda loving Prisma2 at the moment, great work guys !

Activity

  1. pantharshit00 commented on Nov 21, 2019

    @pantharshit00
    Contributor

    Is there a way to introspect "JUST" a particular table in a DB ? Because, if let say I have a large database, then introspecting and generating the data model will take a significant time for user..

    No, currently this is not possible. There is a workaround though in which you can use a user with limited permission. See #807

    Right now everytime I introspect a new DB, I have to copy the models or change the file name to "schema.prisma" before regenerating my Photon API. Is there a way to pass a flag to Prisma2 Introspection so that it use instead the generated datamodel file ? (to make the automation process more efficient).

    It is not possible right now. See prisma/specs#282

    If let say I have 100 different databases, must I have 100 different node module folders each containing Photon API for each of the DB ? Is there a way to make it simpler.

    You can specify the path to generate photon in the schema file(https://github.com/prisma/prisma2/blob/master/docs/prisma-schema-file.md#generators-optional). If you have different databases so types for them will also be different so you do need those files.

    Is is possible to create general API in front of my "multiple" Photon APIs ? For example once I receive and API call from user, I have a general script that reads user info and points to the right Photon API and retrieve data accordingly ?

    You are talking about a multi tenent setup. Photon is not a good fit for that right now. Actually you can use Prisma 1 here. Here is a post about that: https://medium.zenika.com/building-a-multi-tenant-application-with-prisma-11bf890304d6

  2. shah05 commented on Nov 27, 2019

    @shah05
    Author

    Thanks for your feedback and comment.

  3. BjoernRave commented on Dec 11, 2019

    @BjoernRave

    @shah05 @Errorname is (hopefully soon :D) working on a rework of his multi tenancy lib for prisma: Errorname/prisma-multi-tenant#5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions