Comments (8)
Those are not our limitations but MySQL's. Feel free to take this up to MySQL.
from kysely.
Those are not our limitations but MySQL's. Feel free to take this up to MySQL.
Not sure if I understand the workings under the hood, but I do get a insertId when using mysql2, so maybe not a MySQL limitation
This is the response from mysql2:
{ rows: [], insertId: '0', rowsAffected: 1 }
And in Kysley, I get this:
InsertResult { insertId: undefined, numInsertedOrUpdatedRows: 1n }
The docs mention this:
This property can be undefined when the query contains an on conflict clause that makes the query succeed even when nothing gets inserted.
In my case, there is
- no conflict
- the primary key has an auto increment param
So maybe not an issue with MySQL, something else
from kysely.
Closed, likely a duplicate to #316 :
InsertId is irrelevant and may not be available when the table's primary key is not an auto increment column.
Also, the docs state:
This property can be undefined when the query contains an
on conflict
Still a little bummer that the original query has to be split up into two, but oh well...
from kysely.
@heethjain21, Did you managed to find a workaround?
from kysely.
@heethjain21, Did you managed to find a workaround?
No. I was thinking of creating a PR to fix this, but haven't gotten time yet.
@koskimas could you please point me in the direction where I should be looking to fix this problem? Referring to this comment: #1049 (comment)
I'll start once I manage to get some time.
from kysely.
We have tests. This works. Provide a reproduction.
from kysely.
Strange, it worked this time.
Not sure what the issue was last time.
I wanted to adopt Kysely in our project, but didn't do it because of this error.
I tried a little more times, and it worked all of the time.
Don't remember what might have caused the issue last time.
Thanks for your comment anyways, since I was able to get it working now, so I can use it in my project then!
from kysely.
Using retuning with query builder return undefined.
my workaround is using raw sql
const { rows: [row] } = await sql`INSERT INTO Transaction (accountId, amount, date, description, type) VALUES (${data.toAccountId}, ${data.amount}, ${data.date}, 'TRANSFER', 'DEBIT') RETURNING id`.execute(trx)
from kysely.
Related Issues (20)
- [Discussion][Effect integration] Add Executable inheritence to all Executable Builders HOT 3
- Incorrect `selectAll` typing HOT 6
- Cant use raw table names with Insert/Update/Delete HOT 1
- Mssql connection pooling issue. Multiple server round trips per query. HOT 6
- Discord link expired HOT 1
- suggestion: add isPartitionTable property in TableMetadata interface
- <statement expected> got .... instead when using sql function
- Is Type incorrect in `UpdateQueryNode` HOT 3
- Migration failure for postgresql comment after table create HOT 2
- [Feature Request]: Implement `$nullable` helper, similar to `$nonNull`.
- Idea: query.toString() could be an alias for query.compile() HOT 2
- Add range column types to the schema api HOT 5
- mysql2 `createPoolCluster` support HOT 1
- Coalesce is limited to only 5 arguments HOT 2
- UPDATE with JOIN generates invalid query for MySQL HOT 1
- Kysely implementation of SELECT EXISTS (SELECT 1 FROM .... WHERE ...) HOT 3
- MySQL2 createPool return type mismatch HOT 2
- How to reuse large variable in Kysely `select` query? HOT 1
- SQLite STRICT tables
- Allow plugins that transform results to affect the output type. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kysely.