API Maker's deep populate feature revolutionizes how developers handle complex relational data by fetching nested information from multiple databases with a single API call. No more writing intricate JOIN queries or managing multiple database connections manually.
Traditional database queries require developers to write complex JOIN statements or make multiple API calls to gather related data. Deep Populate eliminates this complexity by automatically creating a network of relationships across multiple database systems, returning comprehensive nested data structures in one api request only.
Before Deep Populate:
-- Multiple queries needed
SELECT
p.id AS person_id,
p.name AS person_name,
s.name AS street_name,
a.name AS area_name
FROM
person p
JOIN
streets s ON p.street_id = s.id
JOIN
area a ON s.area_id = a.id;
With Deep Populate:
/api/schema/user-path/instance/database/table?deep=[{s_key:"state_id"}]
/api/schema/user-path/instance/database/table?deep=[{s_key:"state_id",t_instance:"oracle_db",t_db:"inventory",t_col:"states",t_key:"id"}]
/api/gen/user-path/instance/database/table?deep=[{s_key:"state_id",t_instance:"oracle_db",t_db:"inventory",t_col:"states",t_key:"id"}]
Where traditional ORMs struggle with multi-database or cross-database resource retrieval, API Maker can over come that limitation with the support of 8 database including both SQL and No-SQL databases including MongnoDB, PostgreSQL, MySQL many other which you can check here.
Built-in query optimization ensures that even complex multi-level relationships execute efficiently. The system intelligently batches queries, and implements caching strategies to maintain fast response times.
Database relations are defined at the time of schema creation, When the user targets a specific field via a request, API Maker travels through data by checking the database schema, retrieves the data and wraps the content into a single json response object. This allows API Maker to build relations between different database type instances without any limitation.
Let's say if the user does not want to define a schema and wants dynamic cross database data retrieval or wants to override the default relation, the s_key
and t_key
properties in the deep populate parameter object are used in this scenario. To learn more about this feature, click here.
Example Relationship Chain:
Person → Street → City → Country
Each arrow represents a foreign key relationship that Deep Populate resolves automatically, even when the data is spread across different database types and their installations.
Sample Request Object With Deep Populated Data:
Deep Populate requests use a nested JSON structure that mirrors your data relationships:
{
"find": {
"person_name": "John"
},
"deep": [
{
"s_key": "street_id",
"t_key": "id",
"t_table": "streets",
"deep": [
{
"s_key": "city_id",
"t_key": "id",
"t_table": "cities",
"deep": [
{
"s_key": "country_id",
"t_key": "id",
"t_table": "countries"
}
]
}
]
}
]
}
This structure tells API Maker exactly how to traverse your data relationships, regardless of which databases contain each piece of information.
Sample Response Object With Deep Populated Data:
{
"person_name": "John",
"street_id": {
"id": 5,
"name": "Main Street",
"city_id": {
"id": 101,
"name": "New York",
"country_id": {
"id": 1,
"name": "USA"
}
}
}
}
When dealing with large result sets, The stream APIs can be used to optimize the api response content, The streams can help by providing the content of the request into chunks without loading whole data into memory which will prevent memory overload in larger data infrastructures.
Benefits Of Using Deep Populate With Streams:
The in built caching system recognizes patterns in Deep Populate requests and automatically caches frequently accessed data combinations. This intelligent caching reduces database load and improves response times for common query patterns.
Caching Features:
Database relationships can be defined into api maker schemas which allow user to request the Data by providing the name of the field in the request which makes cross database data retrieval faster and easier. Visit this page for more detail.
{
"find": { "person_name": "Kishan" },
"deep": ["full_address_chain"]
}
select
parameter.Feature Related To Getting Data | API Maker | Supabase | Firebase | Appwrite |
---|---|---|---|---|
Cross-Database Queries | ✅ Native support across 8 database types | ❌ Single PostgreSQL only | ❌ Single Firestore only | ❌ Single database per project |
Real-time Multi DB Relations | ✅ Live updates across databases | ⚠️ PostgreSQL only | ⚠️ Firestore only | ⚠️ Single database |
SQL + NoSQL Integration | ✅ Seamless MySQL → MongoDB queries | ❌ PostgreSQL only | ❌ NoSQL only | ⚠️ Limited SQL support |
Unlimited Nesting Depth | ✅ Person→Street→City→Country→ N Levels | ⚠️ Manual JOIN complexity | ❌ Limited subcollection depth | ⚠️ Manual relationship handling |
Schema-less Dynamic Queries | ✅ Override relations on-the-fly | ❌ Fixed schema required | ❌ Collection structure fixed | ❌ Schema-dependent |
Multi Database Transactions | ✅ Cross database types ACID support | ❌ Single database only | ❌ Limited transaction scope | ❌ Single database only |
Enterprise Database Support | ✅ MySQL ✅ MongoDB ✅ PostgreSQL ✅ MariaDB ✅ Microsoft SQL Server ✅ TiDB ✅ Percona XtraDB ✅ Oracle database |
❌ PostgreSQL only | ❌ Firestore only | ❌ MariaDB Support only |
Deep populate with separate Installations of PostgreSQL database | ✅ Supported | ❌ No support | ❌ No support | ❌ No support |
Cross database types join operations | ✅ Deep populate feature makes it possible without any code | ❌ No support | ❌ No support | ❌ No support |
Supabase excels at PostgreSQL management but struggles with multi-database scenarios.
GraphQL emerged to address several key issues with traditional REST APIs:
API Maker's Deep Populate solves all these problems better than GraphQL and that is without doing any single line of code and works for across database types and across database installations.
Ready to transform your data access layer? Explore API Maker's Deep Populate documentation see how it can simplify your next project.
Deep Populate supports unlimited nesting levels. You can traverse relationships from Person → Street → Area → City → State → Country → Continent → Planet → Galaxy and beyond. Just remember API Maker will take when database will take time.
Absolutely. Deep Populate works with API Maker's real-time features. You can set up webhooks that trigger when any data in your relationship chain changes.
Yes. You can apply filters, sorting, and pagination at any level of your deep populate query.
You can use stream APIs of API Maker for large data sets. API Maker's response will take time when when database will take time. Deep populate feature mostly works with primary keys so, index will be present on data. If index is not present make sure to create them and it will increase performance of data retrival.
Yes, absolutely. Deep Populate seamlessly connects data across all supported databases - MySQL, PostgreSQL, MongoDB, Oracle, SQL Server, MariaDB, TiDB, and Percona XtraDB. You can start with a MongoDB document and traverse to PostgreSQL tables without any additional configuration.
Yes, absolutely. Deep populate feature can get data from mysql only but from different installations types without any coding at all. Same way it works with other database types.
Learn more about API Maker's low-code backend platform and other powerful features at apimaker.dev
{
"find": {
"person_name": "Kishan"
},
"deep": [
{
"s_key": "street_id",
"t_key": "id",
"t_table": "streets",
"deep": [
{
"s_key": "area_id",
"t_key": "id",
"t_table": "areas",
"deep": [
{
"s_key": "city_id",
"t_key": "id",
"t_table": "cities",
"deep": [
{
"s_key": "state_id",
"t_key": "id",
"t_table": "states",
"deep": [
{
"s_key": "country_id",
"t_key": "id",
"t_table": "countries",
"deep": [
{
"s_key": "continent_id",
"t_key": "id",
"t_table": "continents",
"deep": [
{
"s_key": "planet_id",
"t_key": "id",
"t_table": "planets",
"deep": [
{
"s_key": "galexy_id",
"t_key": "id",
"t_table": "galaxies"
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
{
"person_name": "Kishan",
"street_id": { // from MongoDB
"id": 12,
"street_name": "TIRUPATI",
"area_id": { // from MySQL
"id": 24,
"area_name": "RANIP",
"city_id": { // from SQL_SERVER
"id": 382480,
"city_name": "AHMEDABAD",
"state_id": { // from MariaDB
"id": 91,
"state_name": "GUJARAT",
"country_id": { // from Oracle
"id": 4,
"country_name": "INDIA",
"continent_id": { // from PostgreSQL
"id": 3,
"countinent_name": "ASIA"
"planet_id": { // from Ti DB
"id": 2,
"planet_name": "EARTH"
"galexy_id": { // from Percona XtraDB
"id": 1,
"galaxies_name": "Milky Way"
}
}
}
}
}
}
}
}
}