DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • SAP HANA Triggers: Enhancing Database Logic and Automation
  • Designing a Blog Application Using Document Databases
  • Relational DB Migration to S3 Data Lake Via AWS DMS, Part I
  • NoSQL for Relational Minds

Trending

  • Automatic Code Transformation With OpenRewrite
  • Integration Isn’t a Task — It’s an Architectural Discipline
  • Understanding IEEE 802.11(Wi-Fi) Encryption and Authentication: Write Your Own Custom Packet Sniffer
  • Unlocking Data with Language: Real-World Applications of Text-to-SQL Interfaces
  1. DZone
  2. Data Engineering
  3. Databases
  4. Business Logic Database Agent

Business Logic Database Agent

A natural language agent to create database business logic using declarative rules: an admin web app, API, and database in 1 minute. Download to customize in your IDE.

By 
Val Huber user avatar
Val Huber
DZone Core CORE ·
Jan. 17, 25 · Tutorial
Likes (4)
Comment
Save
Tweet
Share
3.0K Views

Join the DZone community and get the full member experience.

Join For Free

In a recent interview, Satya Nadella prophesied the "end of SaaS" with Business Logic Database Agents. The vision was exciting and broad but indefinite. And, it sparked concerns — serious ones.

In this article, we describe a definite (in fact, running) vision for such a system and how to deal with reasonable concerns raised in the comments.

A Business Logic Database Agent

The video imagines "the business logic going into the agents." The exact form of such an agent was left open. We share that vision and, in fact, have been working on it for years. This short article is our take on a Business Logic Database Agent.

The Prompt

Enter this prompt at the GenAI-Logic website:

Business Logic Database Agent
Business Logic Database Agent

Create a system with customers, orders, items and products.
Include a notes field for orders.

Use LogicBank to enforce business logic.
Use case: Check Credit    
    1. The Customer's balance is less than the credit limit
    2. The Customer's balance is the sum of the Order amount_total 
                                                              where date_shipped is null
    3. The Order's amount_total is the sum of the Item amount
    4. The Item amount is the quantity * unit_price
    5. The Item unit_price is copied from the Product unit_price


Observe this is not a “FrankenPrompt” that requires an in-depth programming language or framework background. It’s simply your intent.

The Result: Running Database, API, Web App… and Logic

In about a minute, the system creates a running system:

  1. Database with test data
  2. A JSON:API — multi-table, with filtering, sorting, optimistic locking, pagination, and OpenAPI doc
  3. An admin web app, so you can explore the system. It’s a multi-page app with master-detail, navigation for related data, etc. Here’s a screenshot:
Automatically Created Admin App
Automatically Created Admin App


You can iterate this (e.g., add more tables/attributes, rename them, etc).

More About Logic

The numbered items are the business logic that Nadella spoke about. Such logic addresses: 

  • Multi-table derivations and constraints — these enforce database integrity. This is well beyond familiar support for valid values, null-allowed, etc.
  • Security — authorization and role-based access control
  • Enterprise integration (send the order to shipping on Kafka, email the customer)

We believe our approach is unique. Instead of "your code goes here," this approach provides:

  • Natural language specification, of...
  • Declarative business rules

As Nadella explains, such logic is critical. In fact, for a traditional interactive system, it’s nearly half the effort.

If this were coded in Java or Python, it would require 200 lines of code instead of these five rules. That’s a 40x reduction for the backend half of the system.

If that sounds hard to believe, consider using a procedural language instead of a spreadsheet. You’d see exactly the same explosion of code since declarative automates all your dependency management, optimized data access, transaction management, and logic ordering.

To put it another way, declarative automates re-use. The rules above, perhaps conceived for adding orders, automate nearly a dozen use cases… without error. For example:

  • If the user selects a different product, the system uses its price to re-price the order and check the credit.
  • If the order were assigned to a different customer, one account would be decreased, and the other increased.

Quite a Kickstart

You go from idea to running in one minute. Then iterate. No database design, no screen painting. 

If that’s all there was, it would be a wonderful way to drive the Agile Manifesto: engage business users — with working software — to collaborate and iterate to get the requirements right.

Concerns: Autopilot vs. Copilot

The article got a lot of push-back ("There’s always some odd requirement," "Trust AI with corporate database integrity?"). Quite a lot of push-back.

And they’re absolutely right. The idea that an agent can be an autopilot — just provide a few rules, and it takes over — is indeed losing all control.

And it’s unnecessary. With the proper engineering, you can achieve extensible automation:

  • Automate what makes sense without ceding control to AI
  • Enable customizations using standard languages and tools

So, more of a copilot — takes on certain tasks, but the pilot can take the yoke whenever necessary. For example, the screenshot below shows what happened to our declarative rules:

Logic: Declarative, Natural Language
Logic: Declarative, Natural Language

Standard Dev/Database/Deploy Tooling

It’s a standard Python project. Download it, and use your favorite Dev Tools (IDE, debugger, source control, etc). Use the API with your favorite approaches for custom apps: create UI agents, use Low Code screen painters, traditional UI frameworks, or even the new breed of GenAI-driven UI.  Custom App Dev is dramatically simplified, since the API encapsulates the declarative logic.

The created systems use standard relational databases.

Projects include scripts for creating docker images. Use your favorite deployment tools.

The AI elements are not used for project execution, so your corporate data is not subject to the dreaded hallucination.

Rules, Not FrankenCode

And the logic? It stayed declarative! 

The system did not generate 200 lines of code. It leverages a powerful rules engine, accessed using Python as a Domain Systems Language. It’s the same five lines, just in Python syntax.

GenAI and FrankenCode

You might reasonably wonder — can existing GenAI services build the logic? Why is GenAI-Logic in the loop?  

So, we tried "native GenAI" — it was:

  1. Incorrect: It missed many of the corner cases above (more details here).
  2. Inefficient: It generated code that would run many orders of magnitude slower due to excessive SQL aggregate queries (more details here).
  3. Undesirable: The 200 lines of generated code are exactly what developers hate: FrankenCode, which is hard to understand, debug, and extend.

If the goal is ultimately business transformation, it requires broad adoption across the enterprise — including developers. We believe that a business logic (rules) engine is critical in maintaining a level of abstraction that is transparent and maintainable (for more information, click here).

The Power of Suggestion

The notion of copilot — not autopilot — can be taken one step further. The system provides facilities to suggest logic. Always under developer control, to accept, reject, or modify:

Logic Suggestion Editor
Logic Suggestion Editor


This makes the agent substantially more accessible.  Instead of being a passive robot, the agent can help you learn rules, and trigger your creativity about features you might not have thought about.

More Business Transformation, Less Stress

The industry has long dealt with the stress between:

  • Speed: Accelerate business transformation by enabling line of business users with tools like Low Code, Microsoft Access, etc
  • Governance: IT delivers value by leveraging enterprise-class technology for quality of service, security, performance, integration, etc.

The stress arises since the LOB-focused software may use non-standard databases, might preclude standard dev/deployment tools, etc. This can lead to LOB/IT organizational conflict, the need to support multiple technologies, etc.

The Business Logic Database Agent can reduce this stress: LOB users can kickstart projects even more simply (no database design, no screen painters) yet create projects that can be smoothly transitioned to IT as needs dictate.

It’s Available Now

The realization of Business Logic Database Agents is available now.  It’s open source and free on our website: Genai-Logic. 

Business logic Database Relational database

Opinions expressed by DZone contributors are their own.

Related

  • SAP HANA Triggers: Enhancing Database Logic and Automation
  • Designing a Blog Application Using Document Databases
  • Relational DB Migration to S3 Data Lake Via AWS DMS, Part I
  • NoSQL for Relational Minds

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!