<@U04UQ68083H> if I wanted to use keto with a SQLi...
# ory-copilot
d
@chilly-king-10285 if I wanted to use keto with a SQLite backend is that possible? It's this the same as dsn being memory?
c
A message from kapa.ai
Yes, it is possible to use Ory Keto with a SQLite backend. This is achieved by setting the configuration key
dsn
(Data Source Name) to a SQLite connection string. For example, if the
dsn
is prefixed with
sqlite://
, then SQLite will be used as the storage backend. An example configuration would look like this:
DSN=sqlite:///tmp/some-db.sqlite?_fk=true
. However, using SQLite as a backend is not the same as setting
dsn
to
memory
. When
dsn
is set to
memory
, it means that data is stored in-memory. This is an ephemeral storage method, meaning all data will be removed when the service is killed. This is usually used for quick setup without worrying about setting up a database first. Here is an example of how to set the
dsn
for SQLite and in-memory storage:
Copy code
go func GetSqlite(t testing.TB, mode sqliteMode) *DsnT {    dsn := &DsnT{    MigrateUp: true,    MigrateDown: false,    }       switch mode {    case SQLiteMemory:    dsn.Name = "memory"    dsn.Conn = fmt.Sprintf("<sqlite://file:%s?_fk=true&cache=shared&mode=memory>", t.Name())    case SQLiteFile:    t.Cleanup(func() {    _ = os.Remove("TestDB.sqlite")    })    fallthrough    case SQLiteDebug:    dsn.Name = "sqlite"    dsn.Conn = "<sqlite://file:TestDB.sqlite?_fk=true>"    }       return dsn   }
In this example,
SQLiteMemory
mode sets the
dsn
to an in-memory SQLite database, while
SQLiteFile
and
SQLiteDebug
modes set the
dsn
to a SQLite file database. Sources: - [Data storage and persistence](https://www.ory.sh/docs/self-hosted/deployment#data-storage-and-persistence) - [Debugging Tests](https://www.ory.sh/docs/ecosystem/contributing#debugging-tests)
d
@chilly-king-10285 and if i wanted to use a yml file instead with SQLite?
c
A message from kapa.ai
New message text here