Skip to content

Commit c95feb9

Browse files
committed
article prep
1 parent 52ecb4a commit c95feb9

12 files changed

+47
-94
lines changed

docs/Project-Create-Copilot.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
You can use Copilot chat (if extension installed) to create new databases and projects:
2+
3+
1. Create a model, eg:
4+
5+
<details markdown>
6+
7+
<summary> Show Me How to Use Copilot </summary>
8+
9+
&nbsp;
10+
11+
Paste this into the Copilot prompt:
12+
13+
```
14+
Use SQLAlchemy to create a sqlite database named sample_ai.sqlite, with customers, orders, items and product
15+
16+
Hints: use autonum keys, allow nulls, Decimal types, foreign keys, no check constraints.
17+
18+
Include a notes field for orders.
19+
20+
Create a few rows of only customer and product data.
21+
22+
Enforce the Check Credit requirement (do not generate check constraints):
23+
24+
1. Customer.Balance <= CreditLimit
25+
2. Customer.Balance = Sum(Order.AmountTotal where date shipped is null)
26+
3. Order.AmountTotal = Sum(Items.Amount)
27+
4. Items.Amount = Quantity * UnitPrice
28+
5. Store the Items.UnitPrice as a copy from Product.UnitPrice
29+
```
30+
31+
![copilot](images/sample-ai/copilot/copilot.jpg)
32+
</details>
33+
34+
<br>
35+
36+
2. Paste the copilot response into a new `sample_ai.py` file
37+
38+
3. Create your project:
39+
40+
```bash
41+
als create --project-name=sample_ai --from-model=sample_ai.py --db-url=sqlite
42+
```
43+
44+
4. This will create your database, create an API Logic Project from it, and launch your IDE.

docs/Sample-AI.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Use ChatGPT to generate SQL commands for database creation:
5050

5151
Create a few rows of only customer and product data.
5252

53-
Enforce the Check Credit requirement:
53+
Use Logic Bank to enforce the Check Credit requirement:
5454

5555
1. Customer.Balance <= CreditLimit
5656
2. Customer.Balance = Sum(Order.AmountTotal where date shipped is null)
@@ -59,7 +59,7 @@ Use ChatGPT to generate SQL commands for database creation:
5959
5. Store the Items.UnitPrice as a copy from Product.UnitPrice
6060
&nbsp;
6161

62-
This creates standard SQL, [like this](https://github.com/ApiLogicServer/ApiLogicServer-src/blob/main/api_logic_server_cli/prototypes/sample_ai/database/chatgpt/sample_ai.sql){:target="_blank" rel="noopener"}. Copy the generated SQL commands into a file, say, `sample-ai.sql`:
62+
This creates standard SQL, [like this](https://github.com/ApiLogicServer/ApiLogicServer-src/blob/main/api_logic_server_cli/prototypes/sample_ai/database/chatgpt/sample_ai.sql){:target="_blank" rel="noopener"}. Copy the generated SQL commands into a file, say, `sample-ai.sql`. (As always with AI, eyeball the result - for example, you may need to remove a command like "CREATE DATABASE store.db;").
6363

6464
Then, create the database:
6565

docs/Tech-Copilot.md

Lines changed: 0 additions & 92 deletions
This file was deleted.
Loading
738 KB
Loading
727 KB
Loading
Loading
168 KB
Loading
447 KB
Loading

docs/images/sample-ai/custom-api.jpg

491 KB
Loading
625 KB
Loading

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ nav:
3636
- 0. ApiLogicServer create:
3737
- "Create": Project-Structure.md
3838
- "Manager": Manager.md
39+
- "Create With Copilot": Project-Create-Copilot.md
3940
- "Rebuild": Project-Rebuild.md
4041
- "Virtual Environment": Project-Env.md
4142
- "Builders": Project-Builders.md

0 commit comments

Comments
 (0)