-
-
Notifications
You must be signed in to change notification settings - Fork 474
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
Enable sqlite returning with feature flag #2070
Conversation
57ca352
to
f1fcb64
Compare
f1fcb64
to
a1e11b5
Compare
Thank you for the contribution. I think at runtime, upon Pool creation, we can do a We can enable this flag by default at some point in the future. |
I added the check. Let me know if you like the approach and if there is a better way to return the errors. |
.github/workflows/rust.yml
Outdated
@@ -308,6 +308,7 @@ jobs: | |||
matrix: | |||
runtime: [async-std] | |||
tls: [native-tls, rustls] | |||
sqlite_flavor: ["", returning_clauses_for_sqlite_3_35] |
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.
Your yml skills are very good!
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.
A few clippy warnings but otherwise great.
Actually I'd rename the feature to sqlite-use-returning-for-3_35
Thank you! |
🎉 Released In 0.12.14 🎉Thank you everyone for the contribution! |
2 similar comments
🎉 Released In 0.12.14 🎉Thank you everyone for the contribution! |
🎉 Released In 0.12.14 🎉Thank you everyone for the contribution! |
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [sea-orm](https://www.sea-ql.org/SeaORM) ([source](https://togithub.com/SeaQL/sea-orm)) | dev-dependencies | patch | `0.12.3` -> `0.12.15` | | [sea-orm](https://www.sea-ql.org/SeaORM) ([source](https://togithub.com/SeaQL/sea-orm)) | dependencies | patch | `0.12.3` -> `0.12.15` | --- ### Release Notes <details> <summary>SeaQL/sea-orm (sea-orm)</summary> ### [`v0.12.15`](https://togithub.com/SeaQL/sea-orm/releases/tag/0.12.15) [Compare Source](https://togithub.com/SeaQL/sea-orm/compare/0.12.14...0.12.15) ##### Enhancements - `DerivePartialModel` macro attribute `entity` now supports `syn::Type` [SeaQL/sea-orm#2137 ```rust #[derive(DerivePartialModel)] #[sea_orm(entity = "<entity::Model as ModelTrait>::Entity")] struct EntityNameNotAIdent { #[sea_orm(from_col = "foo2")] _foo: i32, #[sea_orm(from_col = "bar2")] _bar: String, } ``` - Added `RelationDef::from_alias()` [SeaQL/sea-orm#2146 ```rust assert_eq!( cake::Entity::find() .join_as( JoinType::LeftJoin, cake_filling::Relation::Cake.def().rev(), cf.clone() ) .join( JoinType::LeftJoin, cake_filling::Relation::Filling.def().from_alias(cf) ) .build(DbBackend::MySql) .to_string(), [ "SELECT `cake`.`id`, `cake`.`name` FROM `cake`", "LEFT JOIN `cake_filling` AS `cf` ON `cake`.`id` = `cf`.`cake_id`", "LEFT JOIN `filling` ON `cf`.`filling_id` = `filling`.`id`", ] .join(" ") ); ``` ### [`v0.12.14`](https://togithub.com/SeaQL/sea-orm/blob/HEAD/CHANGELOG.md#01214---2024-02-05) [Compare Source](https://togithub.com/SeaQL/sea-orm/compare/0.12.12...0.12.14) - Added feature flag `sqlite-use-returning-for-3_35` to use SQLite's returning [SeaQL/sea-orm#2070 - Added Loco example [SeaQL/sea-orm#2092 ### [`v0.12.12`](https://togithub.com/SeaQL/sea-orm/blob/HEAD/CHANGELOG.md#01212---2024-01-22) [Compare Source](https://togithub.com/SeaQL/sea-orm/compare/0.12.11...0.12.12) ##### Bug Fixes - \[sea-orm-cli] Fix entity generation for non-alphanumeric enum variants[SeaQL/sea-orm#1821 - \[sea-orm-cli] Fix entity generation for relations with composite keys[SeaQL/sea-orm#2071 ##### Enhancements - Added `ConnectOptions::test_before_acquire` ### [`v0.12.11`](https://togithub.com/SeaQL/sea-orm/blob/HEAD/CHANGELOG.md#01211---2024-01-14) [Compare Source](https://togithub.com/SeaQL/sea-orm/compare/0.12.10...0.12.11) ##### New Features - Added `desc` to `Cursor` paginator [SeaQL/sea-orm#2037 ##### Enhancements - Improve query performance of `Paginator`'s `COUNT` query [SeaQL/sea-orm#2030 - Added SQLx slow statements logging to `ConnectOptions` [SeaQL/sea-orm#2055 - Added `QuerySelect::lock_with_behavior` [SeaQL/sea-orm#1867 ##### Bug Fixes - \[sea-orm-macro] Qualify types in `DeriveValueType` macro [SeaQL/sea-orm#2054 ##### House keeping - Fix clippy warnings on 1.75 [SeaQL/sea-orm#2057 ### [`v0.12.10`](https://togithub.com/SeaQL/sea-orm/blob/HEAD/CHANGELOG.md#01210---2023-12-14) [Compare Source](https://togithub.com/SeaQL/sea-orm/compare/0.12.9...0.12.10) ##### New Features - \[sea-orm-macro] Comment attribute for Entity (`#[sea_orm(comment = "action")]`); `create_table_from_entity` supports comment [SeaQL/sea-orm#2009 - Added "proxy" (feature flag `proxy`) to database backend [SeaQL/sea-orm#1881, [SeaQL/sea-orm#2000 ##### Enhancements - Cast enums in `is_in` and `is_not_in` [SeaQL/sea-orm#2002 ##### Upgrades - Updated `sea-query` to `0.30.5` https://github.com/SeaQL/sea-query/releases/tag/0.30.5 ### [`v0.12.9`](https://togithub.com/SeaQL/sea-orm/blob/HEAD/CHANGELOG.md#0129---2023-12-08) [Compare Source](https://togithub.com/SeaQL/sea-orm/compare/0.12.8...0.12.9) ##### Enhancements - Add source annotations to errors [SeaQL/sea-orm#1999 ##### Upgrades - Updated `sea-query` to `0.30.4` https://github.com/SeaQL/sea-query/releases/tag/0.30.4 ### [`v0.12.8`](https://togithub.com/SeaQL/sea-orm/blob/HEAD/CHANGELOG.md#0128---2023-12-04) [Compare Source](https://togithub.com/SeaQL/sea-orm/compare/0.12.7...0.12.8) ##### Enhancements - Implement `StatementBuilder` for `sea_query::WithQuery` [SeaQL/sea-orm#1960 ##### Upgrades - Upgrade `axum` example to `0.7` [SeaQL/sea-orm#1984 ### [`v0.12.7`](https://togithub.com/SeaQL/sea-orm/blob/HEAD/CHANGELOG.md#0127---2023-11-22) [Compare Source](https://togithub.com/SeaQL/sea-orm/compare/0.12.6...0.12.7) ##### Enhancements - Added method `expr_as_` that accepts `self` [SeaQL/sea-orm#1979 ##### Upgrades - Updated `sea-query` to `0.30.3` https://github.com/SeaQL/sea-query/releases/tag/0.30.3 ### [`v0.12.6`](https://togithub.com/SeaQL/sea-orm/blob/HEAD/CHANGELOG.md#0126---2023-11-13) [Compare Source](https://togithub.com/SeaQL/sea-orm/compare/0.12.5...0.12.6) ##### New Features - Added `#[sea_orm(skip)]` for `FromQueryResult` derive macro [SeaQL/sea-orm#1954 ### [`v0.12.5`](https://togithub.com/SeaQL/sea-orm/blob/HEAD/CHANGELOG.md#0125---2023-11-12) [Compare Source](https://togithub.com/SeaQL/sea-orm/compare/0.12.4...0.12.5) ##### Bug Fixes - \[sea-orm-cli] Fix duplicated active enum use statements on generated entities[SeaQL/sea-orm#1953 - \[sea-orm-cli] Added `--enum-extra-derives` [SeaQL/sea-orm#1934 - \[sea-orm-cli] Added `--enum-extra-attributes` [SeaQL/sea-orm#1952 ### [`v0.12.4`](https://togithub.com/SeaQL/sea-orm/blob/HEAD/CHANGELOG.md#0124---2023-10-19) [Compare Source](https://togithub.com/SeaQL/sea-orm/compare/0.12.3...0.12.4) ##### New Features - Add support for root JSON arrays [SeaQL/sea-orm#1898 Now the following works (requires the `json-array` / `postgres-array` feature)! ```rust #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "json_struct_vec")] pub struct Model { #[sea_orm(primary_key)] pub id: i32, #[sea_orm(column_type = "Json")] pub struct_vec: Vec<JsonColumn>, } #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, FromJsonQueryResult)] pub struct JsonColumn { pub value: String, } ``` ##### Enhancements - Loader: use `ValueTuple` as hash key [SeaQL/sea-orm#1868 ##### Upgrades - Updated `sea-query` to `0.30.2` https://github.com/SeaQL/sea-query/releases/tag/0.30.2 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "after 3pm on Wednesday" in timezone America/New_York, 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 these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- Release Notes: - N/A <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MzguMCIsInVwZGF0ZWRJblZlciI6IjM3LjQzOC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [sea-orm](https://www.sea-ql.org/SeaORM) ([source](https://togithub.com/SeaQL/sea-orm)) | dev-dependencies | patch | `0.12.3` -> `0.12.15` | | [sea-orm](https://www.sea-ql.org/SeaORM) ([source](https://togithub.com/SeaQL/sea-orm)) | dependencies | patch | `0.12.3` -> `0.12.15` | --- ### Release Notes <details> <summary>SeaQL/sea-orm (sea-orm)</summary> ### [`v0.12.15`](https://togithub.com/SeaQL/sea-orm/releases/tag/0.12.15) [Compare Source](https://togithub.com/SeaQL/sea-orm/compare/0.12.14...0.12.15) ##### Enhancements - `DerivePartialModel` macro attribute `entity` now supports `syn::Type` [SeaQL/sea-orm#2137 ```rust #[derive(DerivePartialModel)] #[sea_orm(entity = "<entity::Model as ModelTrait>::Entity")] struct EntityNameNotAIdent { #[sea_orm(from_col = "foo2")] _foo: i32, #[sea_orm(from_col = "bar2")] _bar: String, } ``` - Added `RelationDef::from_alias()` [SeaQL/sea-orm#2146 ```rust assert_eq!( cake::Entity::find() .join_as( JoinType::LeftJoin, cake_filling::Relation::Cake.def().rev(), cf.clone() ) .join( JoinType::LeftJoin, cake_filling::Relation::Filling.def().from_alias(cf) ) .build(DbBackend::MySql) .to_string(), [ "SELECT `cake`.`id`, `cake`.`name` FROM `cake`", "LEFT JOIN `cake_filling` AS `cf` ON `cake`.`id` = `cf`.`cake_id`", "LEFT JOIN `filling` ON `cf`.`filling_id` = `filling`.`id`", ] .join(" ") ); ``` ### [`v0.12.14`](https://togithub.com/SeaQL/sea-orm/blob/HEAD/CHANGELOG.md#01214---2024-02-05) [Compare Source](https://togithub.com/SeaQL/sea-orm/compare/0.12.12...0.12.14) - Added feature flag `sqlite-use-returning-for-3_35` to use SQLite's returning [SeaQL/sea-orm#2070 - Added Loco example [SeaQL/sea-orm#2092 ### [`v0.12.12`](https://togithub.com/SeaQL/sea-orm/blob/HEAD/CHANGELOG.md#01212---2024-01-22) [Compare Source](https://togithub.com/SeaQL/sea-orm/compare/0.12.11...0.12.12) ##### Bug Fixes - \[sea-orm-cli] Fix entity generation for non-alphanumeric enum variants[SeaQL/sea-orm#1821 - \[sea-orm-cli] Fix entity generation for relations with composite keys[SeaQL/sea-orm#2071 ##### Enhancements - Added `ConnectOptions::test_before_acquire` ### [`v0.12.11`](https://togithub.com/SeaQL/sea-orm/blob/HEAD/CHANGELOG.md#01211---2024-01-14) [Compare Source](https://togithub.com/SeaQL/sea-orm/compare/0.12.10...0.12.11) ##### New Features - Added `desc` to `Cursor` paginator [SeaQL/sea-orm#2037 ##### Enhancements - Improve query performance of `Paginator`'s `COUNT` query [SeaQL/sea-orm#2030 - Added SQLx slow statements logging to `ConnectOptions` [SeaQL/sea-orm#2055 - Added `QuerySelect::lock_with_behavior` [SeaQL/sea-orm#1867 ##### Bug Fixes - \[sea-orm-macro] Qualify types in `DeriveValueType` macro [SeaQL/sea-orm#2054 ##### House keeping - Fix clippy warnings on 1.75 [SeaQL/sea-orm#2057 ### [`v0.12.10`](https://togithub.com/SeaQL/sea-orm/blob/HEAD/CHANGELOG.md#01210---2023-12-14) [Compare Source](https://togithub.com/SeaQL/sea-orm/compare/0.12.9...0.12.10) ##### New Features - \[sea-orm-macro] Comment attribute for Entity (`#[sea_orm(comment = "action")]`); `create_table_from_entity` supports comment [SeaQL/sea-orm#2009 - Added "proxy" (feature flag `proxy`) to database backend [SeaQL/sea-orm#1881, [SeaQL/sea-orm#2000 ##### Enhancements - Cast enums in `is_in` and `is_not_in` [SeaQL/sea-orm#2002 ##### Upgrades - Updated `sea-query` to `0.30.5` https://github.com/SeaQL/sea-query/releases/tag/0.30.5 ### [`v0.12.9`](https://togithub.com/SeaQL/sea-orm/blob/HEAD/CHANGELOG.md#0129---2023-12-08) [Compare Source](https://togithub.com/SeaQL/sea-orm/compare/0.12.8...0.12.9) ##### Enhancements - Add source annotations to errors [SeaQL/sea-orm#1999 ##### Upgrades - Updated `sea-query` to `0.30.4` https://github.com/SeaQL/sea-query/releases/tag/0.30.4 ### [`v0.12.8`](https://togithub.com/SeaQL/sea-orm/blob/HEAD/CHANGELOG.md#0128---2023-12-04) [Compare Source](https://togithub.com/SeaQL/sea-orm/compare/0.12.7...0.12.8) ##### Enhancements - Implement `StatementBuilder` for `sea_query::WithQuery` [SeaQL/sea-orm#1960 ##### Upgrades - Upgrade `axum` example to `0.7` [SeaQL/sea-orm#1984 ### [`v0.12.7`](https://togithub.com/SeaQL/sea-orm/blob/HEAD/CHANGELOG.md#0127---2023-11-22) [Compare Source](https://togithub.com/SeaQL/sea-orm/compare/0.12.6...0.12.7) ##### Enhancements - Added method `expr_as_` that accepts `self` [SeaQL/sea-orm#1979 ##### Upgrades - Updated `sea-query` to `0.30.3` https://github.com/SeaQL/sea-query/releases/tag/0.30.3 ### [`v0.12.6`](https://togithub.com/SeaQL/sea-orm/blob/HEAD/CHANGELOG.md#0126---2023-11-13) [Compare Source](https://togithub.com/SeaQL/sea-orm/compare/0.12.5...0.12.6) ##### New Features - Added `#[sea_orm(skip)]` for `FromQueryResult` derive macro [SeaQL/sea-orm#1954 ### [`v0.12.5`](https://togithub.com/SeaQL/sea-orm/blob/HEAD/CHANGELOG.md#0125---2023-11-12) [Compare Source](https://togithub.com/SeaQL/sea-orm/compare/0.12.4...0.12.5) ##### Bug Fixes - \[sea-orm-cli] Fix duplicated active enum use statements on generated entities[SeaQL/sea-orm#1953 - \[sea-orm-cli] Added `--enum-extra-derives` [SeaQL/sea-orm#1934 - \[sea-orm-cli] Added `--enum-extra-attributes` [SeaQL/sea-orm#1952 ### [`v0.12.4`](https://togithub.com/SeaQL/sea-orm/blob/HEAD/CHANGELOG.md#0124---2023-10-19) [Compare Source](https://togithub.com/SeaQL/sea-orm/compare/0.12.3...0.12.4) ##### New Features - Add support for root JSON arrays [SeaQL/sea-orm#1898 Now the following works (requires the `json-array` / `postgres-array` feature)! ```rust #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "json_struct_vec")] pub struct Model { #[sea_orm(primary_key)] pub id: i32, #[sea_orm(column_type = "Json")] pub struct_vec: Vec<JsonColumn>, } #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, FromJsonQueryResult)] pub struct JsonColumn { pub value: String, } ``` ##### Enhancements - Loader: use `ValueTuple` as hash key [SeaQL/sea-orm#1868 ##### Upgrades - Updated `sea-query` to `0.30.2` https://github.com/SeaQL/sea-query/releases/tag/0.30.2 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "after 3pm on Wednesday" in timezone America/New_York, 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 these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- Release Notes: - N/A <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MzguMCIsInVwZGF0ZWRJblZlciI6IjM3LjQzOC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Following the discussion in #654 and this comment #1885 (comment) this PR adds a feature flag to mark SQLite as a returning backend.
For my use case, this means to be able to use other types as primary keys with SQLite.
PR Info
New Features
This PR adds a new feature:
returning_clauses_for_sqlite_3_35
.This enables the SQLite backend to be a returning backend.
With this feature, the user must ensure that the application links to SQLite version >= 3.35.