初探 Data API Builder By Alan Tsai 在幾分鐘內將資料庫轉換成 REST 和 GraphQL 不再是夢想
簡單的自我介紹 2 @Alan Tsai 的學習筆記 • Alan Tsai • 蔡孟玹 • 後端工程師 - .NET 技術為主 • 喜歡學習不同東西 • Azure • Data Science、Chatbot • Container、DevOps • 加强開發的Tools、架構 • 翻譯文章/軟體 • 兩本翻譯書 • 三門線上課程 • 看小說、玩手游
@Alan Tsai 的學習筆記 教就是最好的學習方式 - 喜歡考證驗證所學 3
喜歡技術分享 4 ▰ 2022 .NET Conf ▻ 談 Event Driven Architecture 之前 是不是該把 Event 規格搞定? CloudEvents 是什麼? | 邁上 Cloud Native App 之路 ▰ 2021 .NET Conf ▻ 不會 Javascript 沒關係 用 Blazor 來解決前端需求成為 Full Stack .NET 開發者吧 ▰ 2020 Global Azure ▻ Azure API Management 協助邁向Open API及Micro Service架構的好用服務 @Alan Tsai 的學習筆記
喜歡技術分享 5 ▰Trainocate ▻AZ-104、AZ-204、AZ-400、DP-200、DP-201、PL-900、DA-100 ▰緯創資通 ▻Github Copilot ▰台灣智慧自動化與機器人協會 ▻運用Python進行大數據分析、機器學習基礎理論課程及人工智慧 – ML.NET ▰中華電信學院 ▻Windows Container 技術實務班、使用Azure AI打造有人工智能的Line聊天機器人 ▻DevOps與CI/CD實務研習班 @Alan Tsai 的學習筆記
歡迎訂閲、按讚 + 分享 FB 粉絲頁 http://fb.alantsai.net Alan Tsai 的學習筆記 https://blog.alantsai.net http://yt.alantsai.net http://bili.alantsai.net 影片 contact@alantsai.net @Alan Tsai 的學習筆記 6 contact@alantsai.net
Agenda 7 ▰Data API Builder (DAB) 是什麼?要解決什麼問題 ▰Demo: ▻Local 如何使用 ▻Azure 如何使用 ▰展望 @Alan Tsai 的學習筆記 Preview
為什麼要用 8 @Alan Tsai 的學習筆
9 Algorithms + Data Structures = Programs
Monolithic 的問題 10 @Alan Tsai 的學習筆記 https://mrtortoise.github.io/architecture/lean/design/patterns/ddd/2 018/03/18/deathstar-architecture.html - John Nicholas Musings​
當不能夠直接 Access DB 的時候怎麼辦? 11 @Alan Tsai 的學習筆記 ▰ Sync – API ▰Async - Event
新的服務 12 @Alan Tsai 的學習筆記
13 @Alan Tsai 的學習筆記 有沒有什麼東西可以 把資料庫直接 API 化?
什麼是 Data API Builder (DAB) ? 14 @Alan Tsai 的學習筆記
什麼是 Data API Builder (DAB) ? 15 @Alan Tsai 的學習筆記 https://github.com/Azure/data-api-builder/tree/main
什麼是 Data API Builder (DAB) ? 16 @Alan Tsai 的學習筆記 • Allow collections, tables, views and stored procedures to be accessed via REST and GraphQL • Support authentication via OAuth2/JWT • Support for EasyAuth when running in Azure • Role-based authorization using received claims • Item-level security via policy expressions
什麼是 Data API Builder (DAB) ? 17 @Alan Tsai 的學習筆記 REST CRUD operations via POST GET PUT PATCH DELETE filtering, sorting and pagination GraphQL queries and mutations filtering, sorting and pagination relationship navigation
什麼是 Data API Builder (DAB) ? 18 @Alan Tsai 的學習筆記 Easy development via dedicated CLI Full integration with Static Web Apps via Database Connection feature when running in Azure Open Source
Demo 19 @Alan Tsai 的學習筆
Scenario 20 @Alan Tsai 的學習筆記 ▰Local ▻Install DAB ▻Container MSSQL Database Setup ▻DAB Setup ▻API ▻GraphQL ▰Azure ▻Static Web App
準備 DAB 21 @Alan Tsai 的學習筆記 ▰需要是 .NET 6+ SDK ​​dotnet --list-sdks dotnet tool install --global Microsoft.DataApiBuilder dab --version
透過 Docker Container 22 @Alan Tsai 的學習筆記 ​​docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=yourStrong(!)Password" -p 1433:1433 - d mcr.microsoft.com/mssql/server:2022-latest​ dab init --database-type "mssql" --connection-string "Server=localhost;Database=BookTest;User ID=sa;Password=yourStrong(!)Password;TrustServerCertificate=true" --host-mode "Development" dab start
Browser 23 @Alan Tsai 的學習筆記 • healthy - https://localhost:5001 • ​Swagger - https://localhost:5001/swagger • API - https://localhost:5001/api/{entity} • GraphQL - https://localhost:5001/graphql
準備資料庫 24 @Alan Tsai 的學習筆記 https://github.com/Azure/data-api-builder/blob/main/samples/getting- started/azure-sql-db/library.azure-sql.sql
加入 Author 25 @Alan Tsai 的學習筆記 ​​dab add Author --source dbo.authors --permissions "anonymous:*"​​​
REST API 26 @Alan Tsai 的學習筆記 https://learn.microsoft.com/en-us/azure/data-api-builder/rest
REST API 27 @Alan Tsai 的學習筆記 https://learn.microsoft.com/en-us/azure/data-api-builder/rest
GraphQL 28 @Alan Tsai 的學習筆記
GraphQL 29 @Alan Tsai 的學習筆記
Relationship 30 @Alan Tsai 的學習筆記 ​​dab update Author --relationship "books" --cardinality "many" -- target.entity "Book" --linking.object "dbo.books_authors"​​​ "relationships":{ "books":{ "cardinality":"many", "target.entity":"Book", "linking.object":"dbo.books_authors" } }"​
Azure – Static Web App 31 @Alan Tsai 的學習筆記 https://github.com/alantsai-samples/dab-swa-todo
Azure – Static Web App 32 @Alan Tsai 的學習筆記
展望未來 33 @Alan Tsai 的學習筆
注意事項 34 @Alan Tsai 的學習筆記 ▰Public Preview ▰未來的 Roadmap ▰Performance
組合技:DB -> CDC -> DW -> DAB = Data API 35 @Alan Tsai 的學習筆記 https://debezium.io/blog/2019/12/18/debezium-1-0-0-final-released/
參考資料 36 @Alan Tsai 的學習筆記 ▰官方文件 ▰Github Repo ▰Sample Repo
CREDITS Special thanks to all the people who made and released these awesome resources for free: ▰ Presentation template by SlidesCarnival ▰ Photographs by Startup Stock Photos 37 @Alan Tsai 的學習筆記

初探 Data API Builder:在幾分鐘內將資料庫轉換成 REST 和 GraphQL 不再是夢想