https://www.prisma.io/ logo
Join SlackCommunities
Powered by
# orm-help
  • a

    Andrew Ross

    09/18/2021, 5:25 PM
    Copy code
    generator client {
      provider      = "prisma-client-js"
      binaryTargets = ["native"]
    }
    Question -- I'm running a docker container on WSL2 Ubuntu (Linux) to host a postgres db but have Prisma et al (remaining codebase) configured in a Windows environment. The native setting for binaryTargets detects the active OS -- that'd be good since a lot of the guys I collab with use Macs... setting the binaryTargets to "native" shouldn't result in a weird side effect like OS oscillation between Windows and Linux right?
    r
    • 2
    • 1
  • i

    Ibad Shaikh

    09/18/2021, 5:42 PM
    Hi, I just want to get the total number of posts in my post table. I tried :
    _prisma.post.count_()
    But it says: Invalid 
    prisma.post.aggregate()
     invocation:\n\n\n  Failed to validate the query: 
    Field does not exist on enclosing type.
     at `Query.aggregatepost.AggregatePost._count Any solution for it? Thanking in advance :)
    r
    • 2
    • 9
  • c

    Chris King

    09/18/2021, 7:44 PM
    Hey guys, I'm relatively new to the coding world and while I really enjoy Prisma, I'm struggling with finding a way to write things cleanly. For example when I do a nested save or create, I'm not sure how best to do that cleanly. Is it a general principle to pass back the same structure from the front end to the back end? What do I do if I need to change that structure? I'm not really sure where to go or what to google when it comes to these topics of cleanly manipulating data and where in the workflow I should actually do the manipulation. Should this be a class of some sort where I pass back the formatted data? I have an example of my code in the thread Any resources and help would be greatly appreciated.
    r
    • 2
    • 4
  • i

    Ibad Shaikh

    09/18/2021, 8:51 PM
    I am using a package prisma-offset-pagination to apply pagination. In this I have to use Prisma Model in my code , how is that possible:
    const result = prismaOffsetPagination({
    model: User,   // How to access prisma model like in this example.
    cursor: <cursor>,
    size: 5,
    buttonNum: 7,
    orderBy: 'id',
    orderDirection: 'desc',
    where: {
    email: {
    contains: 'smallbee',
    },
    },
    prisma: prisma,
    });
    Check Line:2
    j
    r
    • 3
    • 14
  • d

    Dimitri Ivashchuk

    09/19/2021, 7:57 AM
    I am trying to aggregate a count of rows where field is null, what am I doing wrong? 😄
    Copy code
    const countOfUnreadEvents = await prisma.event.aggregate({
        _count: {
          isRead: true,
        },
        where: {
          isRead: null,
        },
      });
    r
    • 2
    • 2
  • l

    Luke Carr

    09/19/2021, 10:11 AM
    Hi all, we're currently evaluating Prisma as an ORM for our GraphQL APIs and I'd love to know if anyone has had any success setting up an Apollo Server DataSource for Prisma? I've taken a look at the Apollo & Prisma page on the official site (https://www.prisma.io/apollo) but was pretty disappointed that it doesn't elaborate any further than just "initialise the client and then reference it in resolvers!". There's an open issue relating to this but it seems to be inactive (https://github.com/prisma/prisma/issues/5017). Any pointers would be greatly appreciated!
    n
    • 2
    • 1
  • p

    Phil Bookst

    09/19/2021, 2:16 PM
    is there an example on how to set up a ssl cert with prisma + supabase hosted on vercel?
  • j

    John Kelly

    09/19/2021, 3:23 PM
    Is there a way to prevent
    rejectOnNotFound
    throwing an exception?
    r
    • 2
    • 1
  • j

    John Kelly

    09/19/2021, 3:26 PM
    My current pattern is
  • j

    John Kelly

    09/19/2021, 3:28 PM
    Untitled.txt
  • j

    John Kelly

    09/19/2021, 3:28 PM
    But it feels clunky, and would be nice to be able to have a cleaner form of it
  • c

    Charles Gaudreau Jackson

    09/19/2021, 4:36 PM
    Hi! 👋
    👋 1
    r
    • 2
    • 1
  • d

    David Sooter

    09/19/2021, 5:24 PM
    Hi there, Im trying to use the prisma client (3.0.2) with a JSON field and would like to use a filter Here is my model: model md_devices {   id                  String    @id @default(dbgenerated("uuid_generate_v4()")) @db.Uuid   tenant              BigInt?   thing_id            String?   @db.VarChar(36)   thing_alternate_id  String?   @db.VarChar(36)   device_id           String?   @db.VarChar(36)   device_alternate_id String?   @db.VarChar(36)   model_id            Int?   properties          Json?   tags                Json?   modified_at         DateTime? @db.Timestamp(6)   created_at          DateTime? @db.Timestamp(6)   modified_by         String?   @db.VarChar(256)   created_by          String?   @db.VarChar(256) } im trying to use the json filter where : { tag: { path: ['fieldName'], equals: 'some value' } } and im getting the following error equals: '355633007893042'\n }\n },\n select: undefined,\n orderBy: undefined\n}\n\nUnknown arg
    path
    in where.tags.path for type JsonNullableFilter. Did you mean
    not
    ? Available args:\ntype JsonNullableFilter {\n equals?: JsonNullValueFilter | Json\n not?: JsonNullValueFilter | Json\n}\n\n\n any ideas
    r
    • 2
    • 1
  • m

    Mikołaj Palkiewicz

    09/19/2021, 5:57 PM
    Does anyone have up-to-date working Bazel rules for Prisma?
  • m

    manuel

    09/19/2021, 7:00 PM
    Hey 🙂
  • m

    manuel

    09/19/2021, 7:05 PM
    I have a question: What is the best option to add such an object structure with the seed script? Besaus I think I need to do it in two steps. First insert the pval.. and then in the second upsert the log2val correct? 🙂
  • m

    manuel

    09/19/2021, 7:05 PM
  • m

    manuel

    09/19/2021, 7:29 PM
    And hte thing is the "HGNC:1323" id are not in every pval and log2val object the same. Meaning some have more some have less HGNC Ids. I was looking for something like
    upsertMany
  • m

    manuel

    09/19/2021, 7:35 PM
    So first I create all analysis, with the
    analysis id
    and
    hgnc id
    and the
    pvalue
    . In the second step I basically need a way to check if the analysis id
    AN-23f23
    and the gene id
    HGNC:11582
    already exist so I can just insert/add the
    log2val
    . if that (analisis id and hgncid) combination doesn't exist I need to create it.
    r
    • 2
    • 1
  • m

    manuel

    09/19/2021, 7:35 PM
    Thanks for the help ❤️
  • d

    David Sooter

    09/20/2021, 5:55 AM
    So im trying to use the example documented here https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields
    const getUsers = await prisma.user.findMany({
    where: {
    extendedPetsData: {
    path: ['petName'],
    equals: 'Claudine',
    },
    },
    })
    But i always get the error : '\nInvalid
    prisma.md_devices.findMany()
    invocation:\n\n{\n take: 1000,\n skip: 0,\n where: {\n tags: {\n path: [\n ~~~~\n 'imei'\n ],\n equals: '352739096253221'\n }\n },\n select: undefined,\n orderBy: undefined\n}\n\nUnknown arg
    path
    in where.tags.path for type JsonNullableFilter. Did you mean
    not
    ? Available args:\ntype JsonNullableFilter {\n equals?: JsonNullValueFilter | Json\n not?: JsonNullValueFilter | Json\n}\n\n'
    r
    • 2
    • 2
  • d

    David Sooter

    09/20/2021, 6:28 AM
  • g

    George / გიორგი

    09/20/2021, 8:09 AM
    Hello guys, i have a question. is there a way to use scalar list for nested array? or it's better to use Json
    r
    • 2
    • 2
  • l

    Luis Kuper

    09/20/2021, 8:45 AM
    Having the "query" logLevel for the prismaClient enabled, every findMany / count query logs an
    OFFSET $<Number>
    at the end, although i didn't provide any args for that, e.g. (having 3 params provided for the query (postgres):
    Copy code
    .... AND "t0"."A" IS NOT NULL))) OFFSET $4) AS "sub"
    I assume the value the prismaClient generates for that OFFSET is always '0' by default, since the query results are as expected and no offset seems to be applied. Is there a reason the prismaClient generates an OFFSET statement for every query?
    r
    • 2
    • 1
  • h

    Harun

    09/20/2021, 11:17 AM
    Hi guys, I am building ecommerce with strapi right now, but i want to use more controlable project with typescript also. I have used Prisma before, but the boilerplate coding is killing me. So i wanted to hear, do anyone know some kind of framework that does boilerplate and authentication api for you? I am looking for Prisma + GraphQL Thanks 🙂
    r
    m
    a
    • 4
    • 10
  • j

    Jonathan

    09/20/2021, 1:57 PM
    Hi folks, to those who have used AWS Fargate / autoscaling to deploy their api with prisma, how do you deal with the connection_pool? We have a strange problem when our autoscaling kicks in. Initially, we have a container with connection-pool of 3. Once a peak arises, we get a second container, and strangely, the first container suddenly only has a connection-pool of 1. Once the second container disappears, that connection-pool of 1 remains (it stays incredibly slow), and all queries for some reason go through this pool. How does one deal with this distribution of connection pools? Can container 1 somehow get its original connection-pool size back?
  • a

    Alireza Haghshenas

    09/20/2021, 3:18 PM
    Hello everyone. We had problems that are blocking for us and are reported in issues: 7894: Prisma can generate an overly complex and inefficient query in some cases and 7892: Cannot use in to filter based on multiple exact json values. We are at the point to investigate if we can contribute fixes to these issues. Is there anything we need to know before diving in? Something like: 1. Some other work is happening and will be merged soon that might fix these problems 2. You are temporarily not accepting such PRs because of some larger thing going on 3. Any pointers to where to start or how to do this 4. ... Thank you.
    r
    • 2
    • 1
  • a

    aniraga

    09/20/2021, 3:49 PM
    Resolved this error by manually creating a prisma file with this as one line in Serverless PG. But, this is really painful and kinda silly. Doesn't prisma support down to PG 9? I wouldn't expect this to happen ALTER TYPE ... ADD cannot be executed from a function or multi-command string
    r
    • 2
    • 4
  • g

    gustav

    09/20/2021, 6:07 PM
    I’m not getting autocompleted types for the Prisma client in VSCode, what can be wrong?
  • g

    gustav

    09/20/2021, 6:09 PM
    ok I get autocomplete when I import the package myself, but not when including it as part of context
1...484485486...637Latest