Closed tilakraj9560 closed 2 years ago
Hi @stephenafamo i got a mail today. prob i missed the reply. I know, i have exposed my internal methods with tx object. since complete flow happens in one txn which involves multiple changes to tables. If we don't use same tx object before committing, i wont be able to read that data.
underlying driver is psql driver. i believe i need to create seperate txn object for each go routine.
Alright makes sense. As far as the psql driver is thread-safe, sqlboiler operations will be too.
If you're having a generation problem please answer these questions before submitting your issue. Thanks!
What version of SQLBoiler are you using (
sqlboiler --version
)?SQLBoiler v4.4.0
What is your database and version (eg. Postgresql 10)
13.6
If this happened at generation time what was the full SQLBoiler command you used to generate your models? (if not applicable leave blank)
If this happened at runtime what code produced the issue? (if not applicable leave blank)
models.TabelName(where(name = ?)).All(ctx, tx)
What is the output of the command above with the
-d
flag added to it? (Provided you are comfortable sharing this, it contains a blueprint of your schema)Please provide a relevant database schema so we can replicate your issue (Provided you are comfortable sharing this)
Further information. What did you do, what did you expect?
i created one tx object and passed to the different go routines which call the same method, to look for some rows.
Running it like that throws error ->
failed to assign queries
. are tx not thread safe in sql boiler?This whole flow works perfectly, if they happen in sequence instead of go routines. Are txns thread safe with sql boiler?