Skip to main content

iQ Interactive: Cool Things for Developers on Couchbase Capella iQ

 The landscape of software development is ever-evolving with the advent of new technologies. As we venture into 2023, natural language processing (NLP) is rapidly emerging as a pivotal aspect of programming. Unlike previous generations of tools that primarily aimed at enhancing coding productivity and code quality, the new generation of Artificial Intelligence (GenAI) tools, like iQ, is set to revolutionize every facet of a developer's workflow. This encompasses a wide range of activities:

  • Reading, writing, and rewriting specifications
  • Designing, prototyping, and coding
  • Reviewing, refactoring, and verifying software
  • Going through the iterative cycle of deploying, debugging, and improving the software
  • Create a draft schema and sample data for any use case
  • Natural language queries.
  • Generate sample queries on a given dataset
  • Fix the syntax error for a query
  • Don't stop here. Let your imagination fly.

Although the insights garnered from iQ are preliminary and should be treated as drafts, the spectrum of tasks one can accomplish with iQ is rich and varied.

iQ is seamlessly integrated into the Developer Query workbench, specifically within an advisory panel located on the right-hand side. This panel includes features such as a history and an index advisor, providing a robust environment for developers to navigate their tasks. By clicking on iQ, you are presented with sample prompts that showcase its capabilities and potential applications, as illustrated in the figure below.  


In this article, we’ll explore ten intriguing iQ functionalities you can leverage with Couchbase, a powerful NoSQL database. I've used a widely recognized travel-sample dataset (in the samples schema) alongside sales data by Kaggle, housed in the collection titled 'mysales' within the same scope. As we delve into the practical applications, a series of sample Q&A segments will unfold the prowess of iQ, illustrating how it can be a game-changer in handling database operations effortlessly.

  • Discover the fields in a collection in depth
  • Learn a new feature or a concept in the product
  • Get suggestions for a task
  • Write interesting queries for charts
  • Simple data analysis

Before we dive in, a note on prompts. The prompt is not an expanded search keyword or a single-sentence question. It's the description of the work we want LLMs to do. The current generation of Large Language Models (LLMs) prefer prompts written in an expository style. But what exactly is expository writing? Simply put, expository writing aims to explain, describe, or inform readers about a specific topic in a clear and straightforward manner. It lays out facts, analysis, or explanations without veering into personal opinions or fictional elements. Common examples of expository writing include textbooks, news articles, and instructional guides. And yes, you guessed it right — I enlisted the help of ChatGPT to provide this crisp explanation!

PROMPT : Explain the fields in the collection mysales

Prompt1

JSON can be a complex nested structure with objects and arrays. You can ask for details about a specific object or an array. Here’s an example from the hotel collection.

PROMPT: explain the field reviews in depth within the hotel collection.

Prompt2

PROMPT: Teach me window functions in Couchbase

prompt3

Now you realize you really want to know more about NTILE() function. You can go deeper with examples.

PROMPT: Teach me NTILE() function with examples

Now, it writes a mini tutorial for you with full examples... but you really want queries that you can run. 

prompt4

PROMPT: Write sample queries with NTILE() on mysales.

prompt5

PROMPT: I need to present my sales data to the company board. What are the sales reports they expect? Write SQL++ queries for each of those reports.

prompt6

PROMPT:  Write queries that produce good data for charts I need to present.

It generates the queries, and with a few clicks, you have charts!

It generates the queries, and with a few clicks, you have charts!

query context

PROMPT: 4 friends went for a golf outing and scored the following: Bob: 71, 68, Sam: 67, 73, Adam: 81, 72, Steve: 68, 73. Create a collection called gold, insert this daa and write queries to generate standard golf leaderboard. The golf leaderboard includes scores for each day, ranking, difference between each golfer and the leader

Here's the output. There are some issues with it... Couchbase script doesn't recognize — as a comment. In the SELECT query, we need to alias all of the objects and use it in all the references. Still, it's quite a good start, aka draft.

SQL


PROMPT: Create a collection for a game retail online store with a detailed user profile. Generate sample data and insert them into this collection.

Here's the output:

SQL


PROMPT:  Write the top 10 queries you can write on this collection.

SQL


Comments

Popular posts from this blog

Swami Vivekananda: The Monk That Nobody Sent to Chicago

  There’s a saying in Chicago: “We don’t want nobody that nobody sent.” This was the cold reception Swami Vivekananda faced when he arrived in the windy city in July 1893, determined to attend the World Parliament of Religions that September. He belonged to no organization, carried no letter of recommendation, his countrymen were nobody, and represented an alien religion to the Western world. As the days passed, his hope of attending the parliament dwindled. With money running out and the odds stacked against him, he left the Windy City and went to Boston, praying for a glimmer of opportunity.  Swamiji came to America to share India’s most profound gift: the wisdom of the Hindu sages, preserved through centuries of oral tradition and embodied by its monks. This was 1893, not 1993—India was under the British grip, its resources drained, and its spirit subdued. Swamiji’s mission was not just a cultural exchange; it was a bold step toward envisioning a future where India could re...

Why Should Databases Go Natural?

From search to CRM, applications are adopting natural language and intuitive interactions. Should databases follow? This article provides a strategic perspective. Amid the many technological evolutions in software and hardware (CISC/RISC, Internet, Cloud, and AI), one technology has endured:  Relational Database Systems   (RDBMS), aka SQL databases. For over 50 years, RDBMS has survived and thrived, overcoming many challenges. It has evolved and adopted beneficial features from emerging technologies like object-relational databases and now competes robustly with   NoSQL databases .  Today, RDBMS dominates the market, with four of the top five databases and seven of the top ten being relational. RDBMS has smartly borrowed ideas, like JSON support, from NoSQL, while NoSQL has also borrowed from RDBMS. NoSQL no longer rejects SQL. From a user perspective, all modern databases have SQL-inspired query language and a set of APIs. All applications manage the respective data...