Neurelo Build Docs
Neurelo Build Docs
  • Introduction
    • Core Concepts
    • Key Features
  • Getting Started
    • Sign-in/Sign-up
    • Dashboard
      • Collapsible Sidebar
      • Light/Dark Mode
      • Account Settings
      • Audit Events
      • User Management
        • Permissions (Member v/s Admin)
      • Org Settings
    • Starting your Neurelo Project
      • Quick Start Guide
      • Step 1 - Add a Data Source
      • Step 2 - Build Definitions
      • Step 3 - Create an Environment
      • Step 4 - Create an API Key
      • Step 5 - Start Runners
      • Try your Neurelo APIs
  • "How to" Videos
    • Product Overview
    • Neurelo APIs & SDKs
    • Project Setup
    • Definitions
    • Environments
    • Data Sources
    • Organization Management
    • Creating and Using Custom Queries
    • Using the Schema Builder to build Relationships
    • Mock Data Generation
  • Definitions
    • Neurelo Schema Editor
      • Schema Builder
      • JSON/YAML Editor
      • Schema Visualization: Entity-Relationship Diagram (ERD)
    • Custom APIs for Complex Queries
      • Write and Commit Custom Queries
      • AI-Assisted Query Generation
      • Deploying Custom API Endpoints
      • Using Variables in your Custom Query
    • Branches and Commits
    • API Docs
  • Environments
    • Creating a new Environment
    • API Playground
    • Observability
    • Migrations
    • API Keys
  • Data Sources
    • PostgreSQL
    • MySQL
    • MongoDB
  • Guides
    • Provisioning Cloud Databases for using with Neurelo
      • PostgreSQL
        • AWS RDS (PostgreSQL)
      • MySQL
        • AWS RDS (MySQL)
      • MongoDB Atlas
    • Mock Data Generation
    • Wipe Data Source
    • Remote Git Repository for Definitions
      • Connecting a Remote Git Repo
      • Creating Commits from Neurelo
      • Syncing Branches
    • Data Viewer
    • Environment/Data Source Tags
    • How to work with Embedded documents and References in MongoDB
    • How to download and use the Postman Collection for your Project
    • Building Python applications with Postgres and FastAPI
    • CI Integration using Neurelo CLI
    • Schema Migrations
    • Schema AI Assist
    • Auto-Introspection
    • Access Policies
    • User Auth
      • Google
      • GitHub
      • GitLab
    • MongoDB Atlas - Migrate GraphQL to Neurelo
    • MongoDB Atlas - Migrate REST Data APIs to Neurelo
  • MongoDB Atlas - Migrate REST Data APIs to Neurelo
  • MongoDB Atlas - Migrate GraphQL APIs to Neurelo
  • Neurelo Schema Language (NSL)
    • Example 1 - DVD Rentals
    • Example 2 - Simple "Posts" App
    • Example 3 - Bookstore
  • Neurelo API Reference (REST)
    • Examples of Neurelo Auto-Generated REST API endpoints
      • Example 1 - Simple “Posts” application
      • Example 2 - "DVD Rentals" application
      • Example 3 - "Bookstore” application
      • cURL API Examples
  • Neurelo API Reference (GraphQL)
  • SDKs
    • TypeScript / JavaScript SDK
    • Go SDK
    • Python SDK
      • Python SDK Tutorial -- News Application
        • News Application using Neurelo’s Python SDKs
  • CLI (Preview Version)
  • Self-Hosted Neurelo Gateways
  • Tutorials
    • Building a Real Time Chat Application with Neurelo and MongoDB using Python
    • Building A Financial Terminal with Neurelo and MongoDB in Rust
    • Building a Restaurant Management System with Neurelo and MongoDB using GraphQL in just a few minutes
    • Bringing Neurelo’s Data APIs to Life Instantly with MySQL
  • Project Examples
  • References
    • Supported Databases
    • Supported OS and Browsers
  • Support
Powered by GitBook
On this page
  • Overview
  • Writing Custom Queries in Neurelo
  1. Definitions
  2. Custom APIs for Complex Queries

Write and Commit Custom Queries

PreviousCustom APIs for Complex QueriesNextAI-Assisted Query Generation

Last updated 1 year ago

Overview

The Custom Queries section in Neurelo is a dynamic workspace where you can manage and create custom queries in native query code. Here’s a step-by-step guide to writing your custom queries:

Writing Custom Queries in Neurelo

Creating custom queries in Neurelo is a straightforward process, facilitated by a user-friendly query editor and built-in AI Assist capabilities. Here’s a step-by-step guide to writing your custom queries:

  1. Locating the Query Editor:

    • Inside your Project, go to the Definition page from the left navigation panel.

    • Click on the Custom Query tab, this will open the custom query editor. This is where you can review and write your queries.

  2. Starting a New Custom Query:

    • When accessing the Custom Query section for the first time, you have two options to start creating custom queries:

      • Look for a section labeled "Custom Queries" with a "Plus" sign next to it.

      • Alternatively, you can click on the "New" button located centrally on the page.

    • Clicking either option will open a pop-up prompt for creating a new endpoint

  3. API Mode and Naming the Endpoint:

    • In the pop-up, you will be asked to select a mode (REST/GraphQL) for your endpoint and provide an "Endpoint Name."

    • Remember, endpoint names can only contain alphanumeric characters, underscores, and dashes (no spaces). Examples: cityQuery, city_query, QUERY500, 200query.

    • After entering a valid name, you can either finalize the creation by clicking "Submit", or cancel by clicking "Cancel"

  4. Writing the Query:

    • Once you submit the endpoint name, the query editor opens for you to type your query.

    • For instance, you can write a query like such as:

  5. Prettifying Your Query:

    • To enhance readability, you can prettify your query format.

    • Locate and click the "Prettify" button at the top of the Query editor. This will instantly format your query into a more readable and user-friendly layout.

  6. Testing your Custom Query

    • After writing a query, you can test the query right on the editing page.

    • Look for "▶️ Test Query" button. Clicking this will open a test playground

    • Enter the "API Key" for the running environment that you wish test this custom query against

    Note - this query will actually run against the data source in use in the environment. You will need to acknowledge this by selecting the checkbox to be able to try this query

    • You will see the data-set result or any error (in case query was not formed correctly) in the playground window

  7. Saving Custom Queries (Commit)

    • After writing a query, you will need to save it for future use.

    • Look for a "Commit" on the page. Clicking this will store your query within Neurelo and instantly create an API endpoint for this query which can be used in an environment.

  8. Searching for Saved Queries:

    • To find a previously saved query, use the search feature on the Custom Query page.

    • Enter keywords or the exact name of the query in the search bar.

    • The search functionality helps you quickly locate the desired query among all the queries you've saved.

Don’t forget to Commit your Custom Query before leaving the page. Committing will also automatically version your custom query.

These features on the Custom Query page allow for efficient management of your custom queries. Whether you're building complex queries for advanced data retrieval or simply experimenting with different data manipulations, Neurelo's environment supports and streamlines your workflow.