# \[ANN\] Caqti 1.8.0 and related news

**URL:** <https://discuss.ocaml.org/t/ann-caqti-1-8-0-and-related-news/9561>\
**Category:** Community\
**Tags:** databases, release, caqti, announce\
**Created:** [March 26, 2022, 9:19am UTC](https://discuss.ocaml.org/t/ann-caqti-1-8-0-and-related-news/9561 "2022-03-26T09:19:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![paurkedal](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/paurkedal/32/586_2.png) [@paurkedal](https://discuss.ocaml.org/u/paurkedal)\
**Post date:** [March 26, 2022, 9:19am UTC](https://discuss.ocaml.org/t/ann-caqti-1-8-0-and-related-news/9561/1 "2022-03-26T09:19:59Z")

</div>

I am happy to announce the second release of [Caqti](https://github.com/paurkedal/ocaml-caqti) this year. The reason for the quick succession is partly an adjustment to the [new API for request construction](https://paurkedal.github.io/ocaml-caqti/caqti/Caqti_request/Infix/index.html) and partly that [matchable error conditions](https://github.com/paurkedal/ocaml-caqti/issues/72) did not make it into the previous release. You can see the full release notes below.

I would also like to thank [OCaml Software Foundation](https://ocaml-sf.org) for sponsoring my efforts on the Caqti project this year, also including most of the work that went into the previous release.

One [feature in progress](https://github.com/paurkedal/ocaml-caqti/issues/38) is a new driver based on the pure-OCaml [pgx](https://github.com/arenadotio/pgx) which should make it possible, with some additional changes to the way drivers are loaded, to target MirageOS. I am note sure if this can be done in a minor release or will require a Caqti 2 branch.

## Release Notes

New features:

- A matchable representation of common causes of errors on the database  
side is now available, with limitations. It focuses on conditions which  
seem most likely useful to handle. At the moment we lack extended error  
codes from SQLite3 needed to make the cause fully precise.

- Expose the underlying error details from database client libraries.  
This is meant to be use as a last resort, and requires directly linking  
with the relevant drivers.

- A second set of request construction operators `->.`, `->?`, `->!`, and  
`->*` were introduced after experience with converting existing code.  
Given the parameter and result type they return a function which  
constructs a request directly from a query string. Avoiding the need to  
compose with `@:-` simplifies local opens and usage with `List.map` etc.

- Environment variables are now expanded in the debug log when using the  
new request constructors introduced in 1.7.0.

- A new `?tweaks_version` connection parameter has been added to control  
when the client is ready to adapt to changes in database session  
parameters or other adjustments of the interaction with specific  
database systems. [[More details available in the documentation.](https://paurkedal.github.io/ocaml-caqti/caqti/tweaks.html)]

- Enable foreign key constraint checks for SQLite3 starting at tweaks  
version 1.8.

Fixes:

- Fixed debug logging to pass the correct driver info to the query  
callback instead of a dummy driver info which would cause a failure if  
unsupported.

Deprecations:

- The `-->` operator was renamed to `-->!`, with a deprecated alias, for  
consistency with the new `->!` operator.

- The old convenience interface for creating requests has been deprecated  
in favour of the new infix operators and the new query template parser.

- Documented-only deprecations of `Caqti_sql_io`, `Caqti_lwt_sql_io`, and  
`Caqti_async_sql_io` have been annotated.

_Correction:_ Enabling of foreign key constraints for SQLite3 starts at tweaks version 1.8 (not 1.7). (Thanks @reynir for noticing!)

---

<div class="post-metadata">

**Author:** ![Haudegen](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/haudegen/32/716_2.png) [@Haudegen](https://discuss.ocaml.org/u/Haudegen)\
**Post date:** [March 26, 2022, 2:54pm UTC](https://discuss.ocaml.org/t/ann-caqti-1-8-0-and-related-news/9561/2 "2022-03-26T14:54:01Z")

</div>

> [@paurkedal](#):
>
> [new API for request construction](https://paurkedal.github.io/ocaml-caqti/caqti/Caqti_request/Infix/index.html)

This link is broken.

---

<div class="post-metadata">

**Author:** ![paurkedal](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/paurkedal/32/586_2.png) [@paurkedal](https://discuss.ocaml.org/u/paurkedal)\
**Post date:** [March 26, 2022, 5:03pm UTC](https://discuss.ocaml.org/t/ann-caqti-1-8-0-and-related-news/9561/3 "2022-03-26T17:03:42Z")

</div>

Thanks for noticing. A new action pipeline for publishing docs broke in a way I don’t understand at the moment. I reverted to the old way, so it should work now.

---

<div class="post-metadata">

**Author:** ![Haudegen](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/haudegen/32/716_2.png) [@Haudegen](https://discuss.ocaml.org/u/Haudegen)\
**Post date:** [March 27, 2022, 12:11am UTC](https://discuss.ocaml.org/t/ann-caqti-1-8-0-and-related-news/9561/4 "2022-03-27T00:11:49Z")

</div>

Thank you. I just switched a Dream project to the new infix syntax - it’s very nice.

---

<div class="post-metadata">

**Author:** ![Levi\_Roth](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/levi_roth/32/2268_2.png) [@Levi\_Roth](https://discuss.ocaml.org/u/Levi_Roth)\
**Post date:** [March 27, 2022, 7:25pm UTC](https://discuss.ocaml.org/t/ann-caqti-1-8-0-and-related-news/9561/5 "2022-03-27T19:25:58Z")

</div>

Is the non-infix method of constructing requests gone now?

---

<div class="post-metadata">

**Author:** ![paurkedal](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/paurkedal/32/586_2.png) [@paurkedal](https://discuss.ocaml.org/u/paurkedal)\
**Post date:** [March 27, 2022, 8:14pm UTC](https://discuss.ocaml.org/t/ann-caqti-1-8-0-and-related-news/9561/6 "2022-03-27T20:14:30Z")

</div>

The old convenience functions have been deprecated and is scheduled for complete removal. A contributing reason to do so is that the template parser has some limitations, which was hard to lift without breaking backwards compatibility. The primitive `Caqti_request.create` function will remain, however, and can be used in combination with the `Caqti_query` module to construct requests without using the new operators.
