Skip to content

Commit a6bcf60

Browse files
committed
add database example
1 parent 7802a08 commit a6bcf60

File tree

17 files changed

+792
-5
lines changed

17 files changed

+792
-5
lines changed

data/semantickernel-data-jdbc/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,9 @@
7878
<artifactId>ojdbc11</artifactId>
7979
<version>23.7.0.25.01</version>
8080
</dependency>
81+
<dependency>
82+
<groupId>io.projectreactor</groupId>
83+
<artifactId>reactor-core</artifactId>
84+
</dependency>
8185
</dependencies>
8286
</project>

samples/semantickernel-demos/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,6 @@
3939
<module>booking-agent-m365</module>
4040
<module>semantickernel-spring-starter</module>
4141
<module>sk-presidio-sample</module>
42+
<module>sk-database-sample</module>
4243
</modules>
4344
</project>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
2+
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
3+
--add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
4+
--add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED
5+
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
6+
--add-exports jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED
7+
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
8+
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
9+
--add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
10+
--add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.3/apache-maven-3.9.3-bin.zip
18+
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Database Sample
2+
3+
This sample demonstrates how to use Semantic Kernel with a database to perform various operations such as creating,
4+
reading, updating, and deleting records. The sample uses SQLite as the database engine.
5+
6+
# Prerequisites
7+
8+
- Docker/Docker Compose
9+
10+
# Running the Sample
11+
12+
- Ensure you have compiled/installed the Semantic Kernel library.
13+
- Copy env.example to .env and fill out the settings.
14+
- Run `./buildAndRun.sh` to build and run the sample.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
set -eux
4+
5+
./mvnw package
6+
7+
docker compose build && docker compose up
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
version: '3.6'
2+
services:
3+
mysql:
4+
hostname: mysql
5+
image: mysql:8.4
6+
command: --mysql-native-password=ON
7+
ports:
8+
- "3306:3306"
9+
environment:
10+
- MYSQL_ROOT_PASSWORD=
11+
- MYSQL_ALLOW_EMPTY_PASSWORD=true
12+
- MYSQL_USER=a-user
13+
- MYSQL_PASSWORD=a-password
14+
- MYSQL_DATABASE=testdb
15+
sk-database-sample:
16+
image: "sk-database-sample"
17+
depends_on:
18+
- mysql
19+
build:
20+
context: .
21+
dockerfile: ./sk-database-sample-dockerfile
22+
secrets:
23+
- ai-config
24+
secrets:
25+
ai-config:
26+
file: ./.env
27+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# If OpenAI
2+
#CLIENT_KEY="<KEY>"
3+
4+
# If Azure OpenAI
5+
#USE_AZURE_CLIENT=true
6+
#CLIENT_ENDPOINT="<ENDPOINT>"
7+
#AZURE_CLIENT_KEY="<KEY>"

0 commit comments

Comments
 (0)