You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/core/initialization.mdx
+23-2Lines changed: 23 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,12 +49,29 @@ This takes care of the following effects:
49
49
50
50
The following environment variables are supported:
51
51
52
-
*`COCOINDEX_DATABASE_URL`: The URL of the Postgres database to use as the internal storage, e.g. `postgres://cocoindex:cocoindex@localhost/cocoindex`
52
+
*`COCOINDEX_DATABASE_URL` (required): The URI of the Postgres database to use as the internal storage, e.g. `postgres://cocoindex:cocoindex@localhost/cocoindex`
53
+
*`COCOINDEX_DATABASE_USER` (optional): The username for the Postgres database. If not provided, username will come from `COCOINDEX_DATABASE_URL`.
54
+
*`COCOINDEX_DATABASE_PASSWORD` (optional): The password for the Postgres database. If not provided, password will come from `COCOINDEX_DATABASE_URL`.
53
55
54
56
## Explicit Initialization
55
57
56
58
Alternatively, for flexibility, you can also explicitly initialize the library by the `init()` function:
57
59
60
+
### Settings
61
+
62
+
It takes a `Settings` object as argument, which is a dataclass that contains the following fields:
63
+
64
+
*`database` (type: `DatabaseConnectionSpec`, required): The connection to the Postgres database.
65
+
66
+
#### DatabaseConnectionSpec
67
+
68
+
`DatabaseConnectionSpec` has the following fields:
69
+
*`uri` (type: `str`, required): The URI of the Postgres database to use as the internal storage, e.g. `postgres://cocoindex:cocoindex@localhost/cocoindex`.
70
+
*`user` (type: `str`, optional): The username for the Postgres database. If not provided, username will come from `uri`.
71
+
*`password` (type: `str`, optional): The password for the Postgres database. If not provided, password will come from `uri`.
Copy file name to clipboardExpand all lines: docs/docs/ops/storages.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,9 @@ It should be a unique table, meaning that no other export target should export t
36
36
37
37
The spec takes the following fields:
38
38
39
-
*`database_url` (type: `str`, optional): The URL of the Postgres database to use as the internal storage, e.g. `postgres://cocoindex:cocoindex@localhost/cocoindex`. If unspecified, will use the same database as the [internal storage](/docs/core/basics#internal-storage).
39
+
*`database` (type: [auth reference](../core/flow_def#auth-registry) to `DatabaseConnectionSpec`, optional): The connection to the Postgres database.
40
+
See [DatabaseConnectionSpec](../core/initialization#databaseconnectionspec) for its specific fields.
41
+
If not provided, will use the same database as the [internal storage](/docs/core/basics#internal-storage).
40
42
41
43
*`table_name` (type: `str`, optional): The name of the table to store to. If unspecified, will generate a new automatically. We recommend specifying a name explicitly if you want to directly query the table. It can be omitted if you want to use CocoIndex's query handlers to query the table.
/// Normalize the key. e.g. the JSON format may change (after code change, e.g. new optional field or field ordering), even if the underlying value is not changed.
202
+
/// This should always return the canonical serialized form.
0 commit comments