-
Notifications
You must be signed in to change notification settings - Fork 255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add OUTPUT
clause support.
#828
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greatness! One thing to consider about the supportsOutput
property. We should probably play it safe and make it optiona.
👏👏👏👏👏👏 |
When will this be getting released? |
@igalklebanov @koskimas Is this on its way to be published? I cannot find docs on how to use it. |
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [kysely](https://github.com/kysely-org/kysely) | [`^0.26.3` -> `^0.27.0`](https://renovatebot.com/diffs/npm/kysely/0.26.3/0.27.4) | [![age](https://developer.mend.io/api/mc/badges/age/npm/kysely/0.27.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/kysely/0.27.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/kysely/0.26.3/0.27.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/kysely/0.26.3/0.27.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>kysely-org/kysely (kysely)</summary> ### [`v0.27.4`](https://github.com/kysely-org/kysely/releases/tag/0.27.4) [Compare Source](https://github.com/kysely-org/kysely/compare/0.27.3...0.27.4) Hey 👋 We've reached 100 contributors AND 1,000 pull requests since our last release! 🍾 Here's all the amazing work done since version 0.27.3... #### 🚀 Features - Added `clearGroupBy()` by [@​dswbx](https://github.com/dswbx) in [kysely-org/kysely#921 - add `objectStrategy` option that allows to not mutate result objects/arrays @​ `ParseJSONResultsPlugin`. by [@​igalklebanov](https://github.com/igalklebanov) in [kysely-org/kysely#953 ##### PostgreSQL 🐘 / SQLite 📘 - Support table names in UpdateQueryBuilder.returningAll by [@​koskimas](https://github.com/koskimas) in kysely-org/kysely@f63327e ##### MySQL 🐬 / MS SQL Server 🥅 - add varbinary data type for mysql by [@​jonasbovyn](https://github.com/jonasbovyn) in [kysely-org/kysely#812 ##### PostgreSQL 🐘 - feat: add 'add column if not exists' for postgres by [@​MarkusWendorf](https://github.com/MarkusWendorf) in [kysely-org/kysely#900 - feat: add '?|' comparison operator by [@​alenap93](https://github.com/alenap93) in [kysely-org/kysely#1006 - feat: add the starts-with postgres comparison operator by [@​boehs](https://github.com/boehs) in [kysely-org/kysely#1029 - postgres introspection getTables handle partition tables as well. by [@​HeikoOsigus](https://github.com/HeikoOsigus) in [kysely-org/kysely#1034 ##### MS SQL Server 🥅 - add `OUTPUT` clause support. by [@​igalklebanov](https://github.com/igalklebanov) in [kysely-org/kysely#828 #### 🐞 Bugfixes - move `preventAwait` to `alter-column-builder`.ts. by [@​igalklebanov](https://github.com/igalklebanov) in [kysely-org/kysely#1031 - fixes The type of `eb` in `selectFrom(eb => ...)` is wrong by [@​koskimas](https://github.com/koskimas) in kysely-org/kysely@873671b - fixes QueryCompilerError: Could not serialize value causes Kysely instance to fail later by [@​koskimas](https://github.com/koskimas) in kysely-org/kysely@a65a7f3 - fixes CamelCasePlugin messes up complex type mappings with setTypeParser by [@​koskimas](https://github.com/koskimas) in kysely-org/kysely@d45a8fa ##### PostgreSQL 🐘 / MS SQL Server 🥅 - Updating visitMergeQuery to join `WhenNode`s with a space by [@​gittgott](https://github.com/gittgott) in [kysely-org/kysely#940 - fix merge queries not being transformed. by [@​igalklebanov](https://github.com/igalklebanov) in [kysely-org/kysely#955 - fix `InferResult` not working for merge queries. by [@​igalklebanov](https://github.com/igalklebanov) in [kysely-org/kysely#902 ##### PostgreSQL 🐘 - Fix typo on timetz regex by [@​dunkelbraun](https://github.com/dunkelbraun) in [kysely-org/kysely#911 ##### MS SQL Server 🥅 - fix `MssqlDialect` streaming not handling backpressure. by [@​igalklebanov](https://github.com/igalklebanov) in [kysely-org/kysely#1041 - fix Tedious v18 includes different TypeScript annotations by [@​igalklebanov](https://github.com/igalklebanov) in [kysely-org/kysely#1041 - handle connection errors @​ `MssqlDriver`. by [@​igalklebanov](https://github.com/igalklebanov) in [kysely-org/kysely#1042 #### 📖 Documentation - fix complex join example by [@​koskimas](https://github.com/koskimas) in kysely-org/kysely@9f836c4 - fix complex join example some more by [@​koskimas](https://github.com/koskimas) in kysely-org/kysely@8f9038f - fix complex insert example by [@​koskimas](https://github.com/koskimas) in kysely-org/kysely@ead3489 - improve subquery insert example by [@​koskimas](https://github.com/koskimas) in kysely-org/kysely@0e194b0 - add not null assertion site example by [@​koskimas](https://github.com/koskimas) in kysely-org/kysely@58ba4ae - fix a bunch of untyped sql snippets in API doc examples by [@​koskimas](https://github.com/koskimas) in kysely-org/kysely@64a56f9 - make it even more clear that table interfaces are not row types by [@​koskimas](https://github.com/koskimas) in kysely-org/kysely@9485b44 - update outdated intro in kysely.dev by [@​koskimas](https://github.com/koskimas) in kysely-org/kysely@e84863d - remove snyk badge. by [@​igalklebanov](https://github.com/igalklebanov) in kysely-org/kysely@4326a91 - add CTE examples to site by [@​koskimas](https://github.com/koskimas) in https://github.com/kysely-org/kysely/commit/d9a53cd1441e0854456e930eb628f5b03a34db93\\ - fix SQLite import @​ getting started. by [@​igalklebanov](https://github.com/igalklebanov) in [kysely-org/kysely#927 - capitalization, more environments @​ README. by [@​igalklebanov](https://github.com/igalklebanov) in kysely-org/kysely@6ab2155 - fixed docs for deno by [@​kolay-v](https://github.com/kolay-v) in [kysely-org/kysely#938 - Added MySQL and MariaDB support information for relation recipes by [@​chriswep](https://github.com/chriswep) in [kysely-org/kysely#800 - Fix spelling, punctuation, grammar by [@​DePasqualeOrg](https://github.com/DePasqualeOrg) in [kysely-org/kysely#969 - Fix typo (it's --> its) by [@​davidalber](https://github.com/davidalber) in [kysely-org/kysely#1000 - add logging documentation page by [@​JeromeBu](https://github.com/JeromeBu) in [kysely-org/kysely#1003 - Docs now reflect `tedious` support in `Bun` by [@​igalklebanov](https://github.com/igalklebanov) in [kysely-org/kysely#1018 - Docs: Fix typo by [@​devgru](https://github.com/devgru) in [kysely-org/kysely#1025 - mention `kysely-ctl` in migrations section. by [@​igalklebanov](https://github.com/igalklebanov) in [kysely-org/kysely#1035 - docs: add comments for `UpdateResult` by [@​movahhedi](https://github.com/movahhedi) in [kysely-org/kysely#993 - fix mssql createPerson example. by [@​igalklebanov](https://github.com/igalklebanov) in [kysely-org/kysely#1048 - docs: fix values example not compiling. by [@​igalklebanov](https://github.com/igalklebanov) in [kysely-org/kysely#1058 - fix typo incorrect by [@​zce](https://github.com/zce) in [kysely-org/kysely#1068 #### 📦 CICD & Tooling - migrate to docker compose v2. by [@​igalklebanov](https://github.com/igalklebanov) in [kysely-org/kysely#932 - ci: bumping actions and runtimes. by [@​igalklebanov](https://github.com/igalklebanov) in [kysely-org/kysely#942 - ci: drop node16 tests as it reached EOL. by [@​igalklebanov](https://github.com/igalklebanov) in kysely-org/kysely@873ed5a - remove docker-compose file version. by [@​igalklebanov](https://github.com/igalklebanov) in [kysely-org/kysely#966 - add node22 @​ tests. by [@​igalklebanov](https://github.com/igalklebanov) in [kysely-org/kysely#964 - export all operation nodes, forever. by [@​igalklebanov](https://github.com/igalklebanov) in [kysely-org/kysely#972 - ci: bump bun, test mssql in bun. by [@​igalklebanov](https://github.com/igalklebanov) in [kysely-org/kysely#1022 - ci: install only chromium by [@​igalklebanov](https://github.com/igalklebanov) in [kysely-org/kysely#1043 - bump TypeScript to v5.5. by [@​igalklebanov](https://github.com/igalklebanov) in [kysely-org/kysely#965 - docs: bump docusaurus to v3. by [@​igalklebanov](https://github.com/igalklebanov) in [kysely-org/kysely#1050 - docs: remove remaining react imports. by [@​igalklebanov](https://github.com/igalklebanov) in [kysely-org/kysely#1057 - ci: split jobs. by [@​igalklebanov](https://github.com/igalklebanov) in [kysely-org/kysely#943 ####⚠️ Breaking Changes #### 🐤 New Contributors - [@​dunkelbraun](https://github.com/dunkelbraun) made their first contribution in [kysely-org/kysely#911 - [@​dswbx](https://github.com/dswbx) made their first contribution in [kysely-org/kysely#921 - [@​kolay-v](https://github.com/kolay-v) made their first contribution in [kysely-org/kysely#938 - [@​chriswep](https://github.com/chriswep) made their first contribution in [kysely-org/kysely#800 - [@​jonasbovyn](https://github.com/jonasbovyn) made their first contribution in [kysely-org/kysely#812 - [@​DePasqualeOrg](https://github.com/DePasqualeOrg) made their first contribution in [kysely-org/kysely#969 - [@​davidalber](https://github.com/davidalber) made their first contribution in [kysely-org/kysely#1000 - [@​JeromeBu](https://github.com/JeromeBu) made their first contribution in [kysely-org/kysely#1003 - [@​alenap93](https://github.com/alenap93) made their first contribution in [kysely-org/kysely#1006 - [@​devgru](https://github.com/devgru) made their first contribution in [kysely-org/kysely#1025 - [@​boehs](https://github.com/boehs) made their first contribution in [kysely-org/kysely#1029 - [@​HeikoOsigus](https://github.com/HeikoOsigus) made their first contribution in [kysely-org/kysely#1034 - [@​movahhedi](https://github.com/movahhedi) made their first contribution in [kysely-org/kysely#993 - [@​zce](https://github.com/zce) made their first contribution in [kysely-org/kysely#1068 **Full Changelog**: kysely-org/kysely@0.27.3...0.27.4 ### [`v0.27.3`](https://github.com/kysely-org/kysely/compare/0.27.2...0.27.3) [Compare Source](https://github.com/kysely-org/kysely/compare/0.27.2...0.27.3) ### [`v0.27.2`](https://github.com/kysely-org/kysely/releases/tag/0.27.2) [Compare Source](https://github.com/kysely-org/kysely/compare/0.27.1...0.27.2) - Add `allowUnorderedMigrations` option for the migrator. [#​723](https://github.com/kysely-org/kysely/issues/723) Awesome work by [@​tracehelms](https://github.com/tracehelms) ❤️ - Fix update and insert query type issues when using `Kysely<any>`. - Improve error messages when passing a wrong column name or wrong type for a column in `UpdateQueryBuilder#set` and `InsertQueryBuilder#values` methods. ### [`v0.27.1`](https://github.com/kysely-org/kysely/releases/tag/0.27.1) [Compare Source](https://github.com/kysely-org/kysely/compare/0.27.0...0.27.1) - [Add `$notNull` type helper](https://github.com/kysely-org/kysely/commit/ad194e1aa15e014d0aea3009039b8caa6ef92767) - Support `for update of table` and friends [#​683](https://github.com/kysely-org/kysely/issues/683) - Support `insert into "person" default values` [#​685](https://github.com/kysely-org/kysely/issues/685) - Support arbitrary expressions in `limit` and `offset` - Support insert, update and delete queries in raw SQL substitutions [#​680](https://github.com/kysely-org/kysely/issues/680) - Fix node 14 regression [#​824](https://github.com/kysely-org/kysely/issues/824) - Fix `fn.agg` regression where two type arguments were required [#​829](https://github.com/kysely-org/kysely/issues/829) ### [`v0.27.0`](https://github.com/kysely-org/kysely/releases/tag/0.27.0) [Compare Source](https://github.com/kysely-org/kysely/compare/0.26.3...0.27.0) - Add mssql dialect. A huge effort by [@​igalklebanov](https://github.com/igalklebanov) ❤️ [#​595](https://github.com/kysely-org/kysely/issues/595) - Add postgres `json_agg` and `to_json` functions to function module - Add `is distinct from` operator [#​673](https://github.com/kysely-org/kysely/issues/673) - Add `set('first_name', 'Jennifer')` variant for update query's `set` method [#​672](https://github.com/kysely-org/kysely/issues/672) - Add `as` statement support for createTable [#​771](https://github.com/kysely-org/kysely/issues/771). Thank you [@​viraxslot](https://github.com/viraxslot) ❤️ - Add `nulls not distinct` option for constraints [#​770](https://github.com/kysely-org/kysely/issues/770). Thank you [@​viraxslot](https://github.com/viraxslot) ❤️ - Add `addIndex` & `dropIndex` @​ AlterTableBuilder [#​720](https://github.com/kysely-org/kysely/issues/720). Thank you [@​Gaspero](https://github.com/Gaspero) - Add `stream()` support for sqlite dialect [#​754](https://github.com/kysely-org/kysely/issues/754). Thank you [@​tgriesser](https://github.com/tgriesser) ❤️ - Fix query and error logging both occur on error. [#​796](https://github.com/kysely-org/kysely/issues/796). Thank you [@​igalklebanov](https://github.com/igalklebanov) ❤️ - Fix type issue with `$if` [#​793](https://github.com/kysely-org/kysely/issues/793). Thank you [@​igalklebanov](https://github.com/igalklebanov) ❤️ - Fix issue where `onConflict..doUpdateSet` used select types instead of update types. [#​792](https://github.com/kysely-org/kysely/issues/792). Thank you [@​igalklebanov](https://github.com/igalklebanov) ❤️ - Add `eb.jsonPath<$>` [#​791](https://github.com/kysely-org/kysely/issues/791). Thank you [@​igalklebanov](https://github.com/igalklebanov) ❤️ - `$narrowType` [supports new type tag `NotNull`](https://github.com/kysely-org/kysely/commit/ad3ee2b0fdb5ed2c55635b1e03b7b09406f12e6b) for an easier way to mark columns not nullable manually - Fix [#​811](https://github.com/kysely-org/kysely/issues/811) - Support arbitrary expressions in `min` and `max` aggregate functions. ##### Breaking changes - `selectNoFrom` is removed from `ExpressionBuilder` due to severe typescript performance issues. `selectNoFrom` still exists in the `Kysely` instance, and in most cases, you can use that instead. See this example on how to migrate: https://kyse.link/?p=s\&i=sqAZIvTQktxgXYzHGkqX. - Types are once again a little bit stricter in some places. You might get type errors from code like ``where('first_name', '=', sql`something`)``. You need to explicitly give a type for the `sql` expressions like this `` sql<string>`something` `` - Deprecated functions `eb.cmpr` and `eb.bxp` have been removed. Use `eb` as a function instead. </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View the [repository job log](https://developer.mend.io/github/dotkom/monoweb). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4yNi4xIiwidXBkYXRlZEluVmVyIjoiMzguMjYuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
closes #687
Hey 👋
output
clause is supported in dialects such as MS SQL Server (MSSQL).It works just like
returning
, but:inserted
for new values,deleted
for old values, and table names/aliases that are not the main table. Since we don't support mssql's way of adding more tables to context in all the queries output is supported in, I left it out for a future PR.merge
queries,$action
returnsdelete
,insert
orupdate
. left it out for a future PR.into
sub-clause. left it out for a future PR.