Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 06:55
    steve-chavez commented #1417
  • 06:49

    steve-chavez on master

    Enforce singular behavior despi… (compare)

  • 06:49
    steve-chavez closed #1417
  • Dec 07 18:48
    dwagin synchronize #1417
  • Dec 07 18:39
    dwagin synchronize #1417
  • Dec 07 18:32
    dwagin synchronize #1417
  • Dec 07 18:14
    dwagin synchronize #1417
  • Dec 07 18:13
    dwagin commented #1423
  • Dec 07 13:43
    Dansvidania commented #1423
  • Dec 07 13:41
    Dansvidania commented #1423
  • Dec 07 13:40
    Dansvidania commented #1423
  • Dec 07 13:39
    Dansvidania commented #1423
  • Dec 07 13:39
    Dansvidania commented #1423
  • Dec 07 13:29
    Dansvidania commented #1423
  • Dec 07 05:43
  • Dec 06 16:15
    steve-chavez commented #1423
  • Dec 06 15:46
  • Dec 06 14:56
    steve-chavez closed #1426
  • Dec 06 03:18
    steve-chavez commented #1426
  • Dec 06 02:53
Jared Dinerstein
@Togaking
Hi chatters: I'm trying to follow the steps outlined in tutorials/tut1.html and I am stuck on the "Step 4. Make a Request". I get the following error when I try to execute the PATCH request. The error is: {"message":"JWSError JWSInvalidSignature"}
the Token I used and exported is: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoidG9kb191c2VyIn0.wj57GklEEYKxK5Av3qfhVY3sqWxRIvjGdTxcB0jcZGA
that's the entirety of it from jwt.io
am I supposed to use only a portion of the token?
@MaitrePylos_gitlab
@Togaking You must send a Bearer authorization headers "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoidG9kb191c2VyIn0.wj57GklEEYKxKxK5Av3qfhVY3sqWxRIvjGdTxcB0jcZGA"
@matrixbot SQL User Management : Did I set up according to the documentation
Jean SIMARD
@woshilapin
Hi there, I'm just discovering Postgrest. My team and I are evaluating it to replace one of our software. However, we're stuck on one functionality. Part of our model are big files. We obviously do not want to upload files into the DB but would it be possible to upload a file which would create an entry in the DB (id, updated date, creation date, path), and at the same time, save the file somewhere else (possibly another server, just acting as a storage filesystem).
Are these kind of scenario already been solved by someone else? Or is there some ideas about how this could be implemented with Postgrest?
Thanks in advance to anyone who would answer
(and by the way, Postgrest is really a nice product, even if in the end we do not use it, thanks to the contributors for this awesome idea!)
Nathan Bouscal
@nbouscal
@woshilapin I haven't had to solve that exact problem, but I'd probably solve it the same way I've solved some related problems: intercept that endpoint with a Lambda, have the Lambda store the files in S3 (or retrieve them for GETs), and then send the metadata on to postgrest. (Swap out Lambda and S3 with whatever equivalents in your environment.)
My application is HTTPS-only, so for us 'interception' is pretty literal; I load-balance those endpoints to Lambda on the 443 listener and have a separate internal-only listener on 80 that the Lambdas send the metadata to; that way the autogenerated OpenAPI schema is still pretty-close-to-accurate. For other situations I imagine you'd just have to have separate routes and the OpenAPI schema would be less accurate.
The other approach would be to put the data into the database temporarily and NOTIFY some process that pulls it out of the database and stores it elsewhere. The benefit of the lambda approach is that the file never even enters memory on the DB server, which I'd naively guess would help avoid performance impacts, but it really depends on how big the files are etc
Jean SIMARD
@woshilapin
Hi @nbouscal, Thanks for the answer. I'm not entirely clear on what you call a Lambda. Are you talking about serverless functions? That would mean having an additionnal proxy (or something less?) in front of the Postgrest?
Nathan Bouscal
@nbouscal
Yeah, sorry for not being clear. And yes it means load balancing / reverse proxy in front of the postgrest instance; that's a good practice in general, e.g. postgrest by itself can't handle HTTPS
This solution makes sense in AWS and I expect it makes sense in other cloud providers; if you're not running this on the cloud then I'm probably going to be less able to give advice :)
Jean SIMARD
@woshilapin
And about the NOTIFY solution, the process are triggered by the DB, right? Does that mean we could launch any kind of process?
Nathan Bouscal
@nbouscal
The database just sends out a notification to existing listeners, it doesn't spawn processes. But basically yes, you can have any kind of process listening for notifications
Jean SIMARD
@woshilapin
(I mean, I could code a process in Java, or Haskell or even bash)
Nathan Bouscal
@nbouscal
Yep, it's a generic pubsub, anything with a postgres library can use it.
Jean SIMARD
@woshilapin
That might be helpful actually because we could just create the entry in the DB giving the URL where to download the file and notify an entry has been created. Then this process would read the entry and be able to download the file somewhere else, then update the DB with the final PATH...
Nathan Bouscal
@nbouscal
Ah, yeah, if the API client can be required to send a link to the file rather than upload the file itself then this problem becomes a bit easier :) (because the memory consideration doesn't apply)
matrixbot
@matrixbot
ךושיל G² (Gitter): For JWT, you generally need two tokens: an access or identity token which has a short expiry and a refresh token which is usually an opaque blob that the client uses to get a new access token. The refresh token is stored in the database it can be checked and revoked. Have a look at subzero refresh token
Jean SIMARD
@woshilapin
Anyway, thanks @nbouscal for the insights
Nathan Bouscal
@nbouscal
Sure thing, hope you end up being able to use postgrest :)
Jean SIMARD
@woshilapin
I hope too ;-)
Gerben Neven
@gerbyzation
Hi guys! We're using postgrest in docker and I'm having some trouble with docker-compose deciding to strip the jwt secret of it's quotes. I've had a look through the docs but can't find much on the possibities with the environment vars.
I don't suppose there's a way to pass the secret base64 encoded?
@MaitrePylos_gitlab

Hello, I'm trying a simple joint

select abreviation from enseignants e
inner join people p
on e.id_people = p.id_people
where p.nom = 'CARAMBAR'
limit 1

I write my route like this, but it doesn't affect the result, can you tell me where I'm wrong?

enseignants?select=*,people(*)&people.nom=eq.CARAMBAR&limit=1
@MaitrePylos_gitlab
In fact as soon as I want to make an avac validation request on the embeded table, it doesn't work!
Steve Chávez
@steve-chavez
@gerbyzation Have you tried using the secret-is-base64 config? In docker it should be PGRST_SECRET_IS_BASE64=true.
Steve Chávez
@steve-chavez
@MaitrePylos_gitlab Hmm.. remember that embedding does subqueries(result similar to LEFT JOIN). For now you could use a VIEW and do the INNER JOIN there and then filter.
@MaitrePylos_gitlab
@steve-chavez Hello, should the inner join or the left join give me the same answer?
select abreviation from enseignants e
left join people p
on e.id_people = p.id_people
where p.nom = 'CARAMBAR'
limit 1
I look at the logs to understand.
Steve Chávez
@steve-chavez
LEFT JOIN should be equivalent to our query
There's an equivalence of the SQL query and the pgrst request mentioned there.
@MaitrePylos_gitlab
people?select=enseignants(abreviation)&nom=eq.ALONSO
@steve-chavez Okay, if I reverse the query and sort the result via my programming language, but I find it disturbing until I get used to it?
Steve Chávez
@steve-chavez
@MaitrePylos_gitlab Yeah, that's a limitation for now. When PostgREST/postgrest#1075 gets solved the requests will be more natural. Though left join will likely stay as default.
Gerben Neven
@gerbyzation
@steve-chavez ah brilliant, hadn't spotted that one, will give it a try!
Andrej Koelewijn
@ako
Hi, i'm trying to bulk upload a csv, but the file contains numeric values with comma separated decimals. Postgrest complains with "invalid input syntax for numeric: ...". How do i tell the system to use dutch language settings? Is there an http header i can use?
François Beausoleil
@francois

Hi all! I didn't know about this Gitter yesterday, so I posted an issue: PostgREST/postgrest#1422

Essentially, PostgreSQL doesn't allow SET LOCAL in STABLE functions. Is there a workaround? I'm trying to set the Content-Type of the response from within a function that I can call with a GET /rpc/get_blob?blob_slug=aslug. Thanks!

Steve Chávez
@steve-chavez
@ako Hmm.. even if we'd accept changing the pg LC_NUMERIC through pgrst that still wouldn't change the numeric pg type default format.
What you could do is to use to_number in a BEFORE INSERT TRIGGER.
Or perhaps just replace could work:
select replace('1234,56', ',', '.')::numeric;
Steve Chávez
@steve-chavez
@francois I've replied on #1422.
Andrej Koelewijn
@ako
@steve-chavez mmm, i'm looking for a way to accepts uploaded csv's in different formats, could be dutch, could be us, could be something else, depends on the user. How it's stored in the database isn't relevant, as long as can format it later in a way that suites the user. A trigger or replace would hardcode data upload to a specific format in the database...
Steve Chávez
@steve-chavez
@ako I see. In that case a VIEW or stored procedure would be better. You could upload the csv with an accompanying Content-Language header and then you could conditionally apply the transformation(specific to each lang). You can use GUCs to read the headers.
Algy Taylor
@AlgyTaylor
Hi all - massive apologies for being a total n00b here. Can I use LDAP for client-side authentication with PostgREST (without lots of work), and (2) I'm a bit of a moron, is there some nice person/people on here that might be able to answer my idiotic questions on that exact subject?
matrixbot
@matrixbot
ךושיל Algy Taylor (Gitter): PostgREST uses JWT for authentication (and authorization to an extent) so you'll need to configure your LDAP service to return a JWT upon successful authentication. There seems to be a few LDAP JWT services.