Development documentation · Some APIs may be unreleased Published release →

Guides

Case: query PostgreSQL objects

Run a small Raven application that sends two queries to PostgreSQL and maps their rows to Person objects. The first uses positional values; the second uses a named parameter object. It needs no tables and changes no persistent database data.

Start with SQL databases to read the query code. Download the complete sample.

Start a local database

The sample requires Docker, Python 3 and a matching development neoCLR bundle with the optional PostgreSQL provider. See setup for the toolchain. The current provider supports local IPv4 loopback and trust authentication only.

docker run --detach --rm --name neoclr-people \
  --publish 127.0.0.1:55432:5432 \
  --env POSTGRES_HOST_AUTH_METHOD=trust postgres:18

Wait for PostgreSQL to report that it is ready. This trust-authenticated database is for local testing; keep the published port bound to loopback.

Open and own the connection

The program passes its port argument to this helper. use disposes the connection after the queries complete, including when an operation fails.

async func ReadPeople(port: int) -> Task<Result<unit, SqlError>> {
    use connection = await PostgresDatabase("postgres", "postgres", port, 60000).Open()?
    return await ShowPeople(connection)
}

ShowPeople is included in the download and shown on the SQL guide. SqlMapper.Query<Person> receives the connection, SQL and plain parameter values. Column aliases select the writable properties to populate.

Run the sample

Extract the download and run:

python3 run.py --bundle /absolute/path/to/neoclr-bundle --port 55432

The runner builds with that bundle's compiler and runs using its default JIT mode. It also retains the model metadata required for property mapping.

42: Café team
43: O'Brien

The two queries return their bound values as rows. Replace their SELECT expressions with a query against your tables while retaining the matching column aliases. The runner saves its build and execution results in build/validation.json.

Stop the disposable database when finished:

docker stop neoclr-people

SQL contracts and limits · PostgreSQL API