CHANGELOG#
Unreleased#
- Squirrel now uses a better name for the generated function connection parameter. (Giacomo Cavalieri)
4.7.0 - 2026-06-03#
-
Squirrel can now pick some better argument names based on the structure of the SQL queries in the generated code. For example:
select squirrel.name from squirrel where squirrel_id = $1The generated function is going to have the following definition:
pub fn select_squirrel( db: pog.Connection, squirrel_id: Int ) -> Result(pog.Returned(GetLoginLinkRow), pog.QueryError) { // ... the generated code ... }Notice how Squirrel could use
squirrel_idas a parameter name rather than a genericarg_1name. (Giacomo Cavalieri) -
Squirrel no longer adds whitespaces on empty comment lines. (Giacomo Cavalieri)
-
Fixed a bug where Squirrel would not properly format generated dealing with more than a single enum. (Giacomo Cavalieri)
4.6.0 - 2025-11-15#
- Added support for the
nametype, represented as a GleamString. (Giacomo Cavalieri)
4.5.0 - 2025-10-24#
-
Squirrel will no longer perform code generation if there's any errors in the queries. Before it would still generate code for the queries with no errors. This would usually lead the codebase in a broken state until all the errors were fixed. (Giacomo Cavalieri)
-
When trying to use a
timestamptz, squirrel will now show a useful hint nudging to use atimestampinstead. (Giacomo Cavalieri)
4.4.2 - 2025-10-06#
- Fix a bug where squirrel would generate invalid code for enums with a long name. (Giacomo Cavalieri)
4.4.1 - 2025-08-25#
- Squirrel now adds return type annotations to the generated code. (Giacomo Cavalieri)
4.4.0 - 2025-08-25#
- Squirrel now adds type annotations to the generated code. (Giacomo Cavalieri)
4.3.0 - 2025-08-22#
-
Added support for the
citexttype. (Leah Ulmschneider) -
Fixed a bug where Squirrel would generate code that is not formatted for queries with many arguments. (Giacomo Cavalieri)
4.2.0 - 2025-07-31#
-
Before writing the generated queries, Squirrel will make sure to not overwrite any file that was not automatically generated. In case a file with the same name already exists, Squirrel will refuse to overwrite it and prompt the used to first rename the existing file. (Giacomo Cavalieri)
-
Squirrel will now include a doc comment at the beginning of each generated module, explaining where the queries come from and what version of squirrel was used to generate the code. (Giacomo Cavalieri)
4.1.0 - 2025-07-28#
-
Squirrel will now pick files under a project's
testanddevdirectories. (Giacomo Cavalieri) -
Fixed a bug where Squirrel wouldn't be able to generate code for
.sqlfiles with adoblock. (Giacomo Cavalieri) -
Fixed a bug where queries would not be generated in a reproducible order, causing
squirrel checkto fail unexpectedly. (Giacomo Cavalieri)
4.0.1 - 2025-07-14#
- Fixed a bug where using numeric types in a query would result in runtime decoding errors. (Giacomo Cavalieri)
4.0.0 - 2025-07-07#
-
Squirrel now supports the
timetype decoded and encoded as acalendar.TimeOfDay. (Giacomo Cavalieri) -
Squirrel now uses the
calendar.Datetype to encode and decodedates. (Giacomo Cavalieri) -
Squirrel now uses the
timestamp.Timestamptype to encode and decodetimestamps. (Giacomo Cavalieri) -
Updated the
pogdependency to>= 4.0.0 and < 5.0.0. (Giacomo Cavalieri)
3.1.0 - 2025-07-04#
-
You can now use the
PGCONNECT_TIMEOUTvariable to set the maximum time in seconds to wait while connecting:# Wait at most 5 seconds before timing out when connecting to the database. export PGCONNECT_TIMEOUT=5 gleam run -m squirrelYou can also change the timeout value when using a connection string, by setting the
connect_timeoutquery parameter:export DATABASE_URL="postgres://user@host:5432/my_db?connect_timeout=5" gleam run -m squirrel -
Updated code for
gleam_stdlib>= 0.61.0 and < 1.0.0. (Giacomo Cavalieri) -
Updated the
mugdependency to>= 3.0.0 and < 4.0.0. (Giacomo Cavalieri)
v3.0.6 - 2025-06-24#
-
Updated the
mugdependency to>= 2.0.0 and < 3.0.0(Giacomo Cavalieri) -
Updated the
tomdependency to>= 2.0.0 and < 3.0.0(Giacomo Cavalieri) -
Updated the
gleam_erlangdependency to>= 1.0.0 and < 2.0.0(Giacomo Cavalieri)
v3.0.5 - 2025-06-22#
- Fixed a bug where the code generated by Squirrel wouldn't be properly formatted in case of a query returned rows with many columns. (Giacomo Cavalieri)
v3.0.4 - 2025-05-19#
- Relaxed the constraint on the
gleam_jsondependency. (Giacomo Cavalieri)
v3.0.3 - 2025-04-28#
- Fixed a bug where Squirrel would not be able to generate code for queries with recursive common table expressions relying on semi joins. (Giacomo Cavalieri)
v3.0.2 - 2025-04-01#
- Fixed a bug where Squirrel couldn't tell a Postgres server had a version below the minimum required one. (Giacomo Cavalieri)
v3.0.1 - 2025-02-16#
-
Fixed a bug where code generation would include an unused import. (Leah Ulmschneider)
-
Fixed a bug where the generated code would not be formatted properly. (Giacomo Cavalieri)
v3.0.0 - 2025-01-20#
-
Added a new command line option
check, to check that the generated code is up to date with the sql queries. (Giacomo Cavalieri) -
The
exitfunction from thesquirrelmodule has been removed. (Giacomo Cavalieri) -
The CLI text displayed by Squirrel will never exceed the 80 chars line limit. (Giacomo Cavalieri)
v2.1.0 - 2024-12-22#
-
The version requirement for
poghas been changed to only permit v3. (Giacomo Cavalieri) -
The generated code no longer relies on the
decodepackage and now uses thegleam/dynamic/decodemodule from thegleam_stdlibpackage. (Giacomo Cavalieri)
v2.0.5 - 2024-12-12#
- Fixed a bug where queries with enum arrays would cause an error. (Leah Ulmschneider)
v2.0.4 - 2024-12-04#
- Replace deprecated
gleam/regexmodule withgleam/regexp. (Surya Rose)
v2.0.3 - 2024-11-28#
- Improved error message when using a Postgres version that's too old. (Giacomo Cavalieri)
v2.0.2 - 2024-11-20#
-
Fixed a bug where certain queries using conditions on foreign key would generate code with the wrong optional types. (Giacomo Cavalieri)
-
dropis now highlighted as a keyword in sql snippets in error messages. (Giacomo Cavalieri)
v2.0.1 - 2024-11-18#
- Fixed a bug where certain queries would generate code with the wrong optional types. (Giacomo Cavalieri)
v2.0.0 - 2024-11-11#
- The generated code now uses the
pogpackage instead ofgleam_pgo. (Giacomo Cavalieri)
v1.8.1 - 2024-11-08#
-
Squirrel now errors if a query returns multiple columns with the same name instead of generating invalid Gleam code. For example:
select 1 as duplicate, 2 as duplicate, 3 as not_duplicateResults in the following error:
Error: Duplicate names โญโ query.sql โ 1 โ select 2 โ 1 as duplicate, 3 โ 2 as duplicate, 4 โ 3 as not_duplicate โ This query returns multiple values sharing the same name: `duplicate`.
v1.8.0 - 2024-10-25#
-
Added support for
postgresqlURL scheme. (Valentin Iancu) -
Switched to
decode's newzeroAPI for generated decoders. (Giacomo Cavalieri) -
Added support for user-defined enums. An enum like this one:
create type squirrel_colour as enum ( 'light_brown', 'grey', 'red' )Is automatically turned into the equivalent Gleam type:
pub type SquirrelColour { LightBrown Grey Red }
v1.7.1 - 2024-09-22#
-
Fixed a bug where a query failing to parse would cause code generation for other queries to fail unexpectedly. (Giacomo Cavalieri)
-
Fixed a bug where a query starting with a semicolon would result in a crash instead of a proper syntax error. (Giacomo Cavalieri)
-
Fixed a bug where the generated code would have needless empty lines. (Giacomo Cavalieri)
v1.7.0 - 2024-09-09#
-
Fixed a bug where an authentication error would result in a failure with a confusing error message. (Giacomo Cavalieri)
-
Added support for the
timestamptype, represented as tuples#(#(Int, Int, Int), #(Int Int Int))with#(#(year, month, day), #(hour, minute, second)). (Tommy Heffernan) -
Fixed a bug where the SQL query displayed in an error would be dimmed out. (Giacomo Cavalieri)
-
Added more SQL keywords to syntax highlighting in error messages. (Giacomo Cavalieri)
v1.6.1 - 2024-09-04#
-
Fixed a bug where squirrel would not properly display some error messages. (Giacomo Cavalieri)
-
Improved syntax highlighting for sql queries displayed in error messages. (Giacomo Cavalieri)
-
Added a small hint in case no query is found, suggesting the correct project structure to follow. (Giacomo Cavalieri)
v1.6.0 - 2024-09-03#
- Added support for the
datetype, represented as a triple#(Int, Int, Int)with#(year, month, day). (Giovanni Paone)
v1.5.0 - 2024-08-19#
- Added support for the
byteatype, represented as aBitArray. (Giacomo Cavalieri)
v1.4.0 - 2024-08-16#
-
Added support for the
uuidtype, represented as aUuid(from theyouidpackage). (Giacomo Cavalieri) -
Fixed a bug where
gleam run -m squirrelwould return a0exit code even in case of errors. (Giacomo Cavalieri)
v1.3.2 - 2024-08-15#
- Fixed a bug where the generated code would be missing a
gleam/listimport when dealing with Postgres arrays. (Giacomo Cavalieri)
v1.3.1 - 2024-08-15#
- Fixed a bug where Squirrel would panic if not able to establish a TCP connection to the postgres server. Now it gracefully handles the error by showing an appropriate error message. (Giacomo Cavalieri)
v1.3.0 - 2024-08-13#
-
One can now use the
DATABASE_URLenv variable to specify a connection string that Squirrel will use to connect to the Postgres database. All the regular Postgres variables are still supported, but Squirrel will pickDATABASE_URLover those if it is set. (Giacomo Cavalieri) -
Added support for the
jsonbtype, encoded as aJson(from thegleam_jsonpackage) and decoded as a GleamString. (Giacomo Cavalieri) -
Added support for the
jsontype, encoded asJson(from thegleam_jsonpackage) and decoded as a GleamString. (Giacomo Cavalieri)
v1.2.0 - 2024-08-12#
-
Squirrel now supports the
SCRAM-SHA-256authentication. (Giacomo Cavalieri) -
Squirrel now uses the name of your Gleam project as the default database name to connect to. (Giacomo Cavalieri)
-
Fixed a bug where Squirrel couldn't generate code for queries that return no rows like
insert into. (Giacomo Cavalieri) -
Avoid panicking when the authenticated user doesn't have the permission to access a given table. (Giacomo Cavalieri)
v1.1.0 - 2024-08-11#
-
Squirrel now supports plaintext password authentication. (Giacomo Cavalieri)
-
Squirrel now uses
"postgres"as the default user in case thePGUSERenvironment variable is not set. (Giacomo Cavalieri) -
Added support for the
varcharandbpchartypes, mapped to GleamStrings. (Giacomo Cavalieri) -
Improved the error message in case Squirrel cannot connect to the Postgres server with the given database and username. Instead of a not-really-helpful
Cannot receive message: Closedthe error now properly explains what went wrong and hot to solve the issue:Error: Cannot connect I couldn't connect to database `database` with user `postgres`. Hint: You can change the default user and database by setting the `PGUSER` and `PGDATABASE` environment variables.
v1.0.1 - 2024-08-09#
- Fixed a bug with the code generation of
Optiontypes. (Giacomo Cavalieri)
v1.0.0 - 2024-08-09#
- ๐ First release!