Newbie problem: "Error: Unbound module" with Petrol

I’m new to OCaml and interested in using Petrol to interact with an sqlite3 database. To start things out, I’m trying to run the first example in the Petrol readme.md. In particular, I want to build the code:

open Petrol
open Petrol.Sqlite3

(* define a new schema *)
let schema = StaticSchema.init ()

(* declare a table *)
let example_table, Expr.[name; age] =
StaticSchema.declare_table schema ~name:“example”
Schema.[
field “name” ~ty:Type.text;
field “age” ~ty:Type.int
]

which I put in the file test1.ml.

First, I install Petrol with:

opam install petrol

I have a dune file which contains

(executable
(name test1)
(libraries petrol))

When I run

dune build test1.exe

I get the error:

File “test1.ml”, line 2, characters 5-19:
2 | open Petrol.Sqlite3
^^^^^^^^^^^^^^
Error: Unbound module Petrol.Sqlite3

So it appears that the line for

open Petrol

worked fine, but it didn’t know how to find Petrol.Sqlite3 which is opened in the next line.

I’ve tried to do

opam install petrol.sqlite3

and

opam install petrol.Sqlite3

which don’t work because it returns an error, “Package petrol has no version sqlite3.” or “Package petrol has no version Sqlite3.”

I tried modifying the dune file to

(executable
(name test1)
(libraries petrol petrol.sqlite3))

(and the same modification with a capital S for Sqlite3) but I get “Error: Library “petrol.sqlite3” not found.” or “Error: Library “petrol.Sqlite3” not found.”

I’m not sure where to go from here to get this working. Any help would be appreciated!

That should work as Sqlite3 is a submodule of Petrol, no extra package needed.

Maybe your package version is too old?
Which version does opam show petrol show? The last one is 1.2.0 Petrol at Opam.

Looking at the source there is no Sqlite3 submodule in version 1.0.0.

Yes, you were right, even though I did opam update and upgrade a not too long ago, it was already out of date for Petrol which appears to be moving fast. Thanks for your help!