Create Data Types
We are almost there now!
Last updated
We are almost there now!
Last updated
We have succesfully connected to our external database. Now by creating custom Data Types through the Bubble SQL Database Connector, we will be able to use our external database tables/fields in a very friendly format within the editor and workflow interfaces.
In order to do this we are going to create a query for each return type definition. Underneath Queries, click the "Add a new query" button. You should now see an input box available that looks like this:
Specify the following fields:
Name: This will be used within the bubble editor and workflows. I recommend something that relates to your table/fields and that is easy to type and remember
Connection: The connection to your database created in the previous step.
Use as: Choose "Both" as this will give you the most flexibility with your results
Query: This is where you type your query that defines the fields of your Data Type that you will use throughout the app.
Note: This query does not have to match the actual query you will use in your app. It just needs to contain the correct return field types. In the example below, all of the fields in the customer table are being returned.
Click "Initialize this query" and you should see a modal that looks like this:
Here you can see that the customer Data Type will have the fields CustomerId, Name, Location and Email with their corresponding Bubble field types. Click the "Save" button if you are happy with the field definitions or cancel if you want to modify the query.
Now we are ready to use the SQL Database Connector Pro plugin and return results to our Bubble application. Let's do that now!