Skip to Main Content
 

Blog title

Quick fetch - An introduction

INFO_LIST

  • Author Head Binubuo
  • Category Binubuo API
  • Created Thu, May 26 2022
 

blog sections

Fetching multiple rows and columns in one call

After using the individual generators and seen all the different synthetic data that can be constructed, creating tables of data would be the next step. There are many ways to create table like data from Binubuo, but the simplest way is to use the quick_fetch. The quick_fetch endpoint can be called with a GET request and a list of generators that should be used to construct the data.

The quick_fetch endpoint is as follows:

https://binubuo.com/api/data/custom/quick_fetch?cols=[comma,separated,generator,list]

Where your comma separated list of generators can be any of the generators available in Binubuo.

One example of a table we could try and create data for, would be one of the tables in the Sakila Mysql Example Database. So let us take the
staff table as an example. It has the following definition:

  • staff_id: A surrogate primary key that uniquely identifies the staff member.
  • first_name: The first name of the staff member.
  • last_name: The last name of the staff member.
  • address_id: A foreign key to the staff member address in the address table.
  • picture: A BLOB containing a photograph of the employee.
  • email: The staff member email address.
  • store_id: The staff member “home store.” The employee can work at other stores but is generally assigned to the store listed.
  • active: Whether this is an active employee. If employees leave, their rows are not deleted from this table; instead, this column is set to FALSE.
  • username: The user name used by the staff member to access the rental system.
  • password: The password used by the staff member to access the rental system. The password should be stored as a hash using the SHA2() function.
  • last_update: When the row was created or most recently updated.

So if we translate the columns into Binubuo generators, it would be:

  • staff_id: medium_number
  • first_name: first_name
  • last_name: last_name
  • address_id: medium_number
  • picture: hex (Currently Binubuo does not support binary output in quick_fetch)
  • email: email
  • store_id: medium_number
  • active: boolean
  • username: username
  • password: md5
  • last_update: near_date

So if we wanted to create data for the staff table quickly to just test something, our call to quick_fetch would look like this:

https://binubuo.com/api/data/custom/quick_fetch?cols=medium_number,first_name,last_name,medium_number,hex,email,medium_number,username,md5,near_date

And this is an example of what the output would look like:

{
    "quick_fetch":[
    {
        "C1":64052
        "C2":"Trinity"
        "C3":"Cook"
        "C4":95372
        "C5":"65ddb87f857c51"
        "C6":"jebuvi@ri.org"
        "C7":57092
        "C8":"5426453424"
        "C9":"dccaf2ecc99c3a6f932610a87b919793"
        "C10":"2022-04-22T19:42:12Z"
    }
    ]
}

Now depending on how many rows you want, simply add the rows parameter to the URL and start fetching some data.

Next time we will look at a few more examples of what quick_fetch can do, and how diverse the synthetic data it creates can be.

Don't have an account yet?

If you don't have an account on Binubuo yet, you can create one real quick. Just click "Sign up" in the top right corner, and you are on your way to create all the synthetic data you could dream about.

Want to see how to get started: Get Started Guide

Get more guides and help from the blog