Attributes

Attributes

Attributes

Basedash uses the terms attributes over columns
image

Why not use the term “columns”?

Basedash doesn’t use the term columns, but instead uses the term attributes when referencing database columns. This is because Basedash plans include other data source types than SQL databases in the future. If we were to support MongoDB and Firebase data sources to be connected to Basedash, the concept of columns doesn’t exist in MongoDB or Firebase. However, we would still like to be able to let users setup display attributes (see below) on their MongoDB or Firebase data sources.

Attribute types

Basedash converts underlying database column types to one of the following attribute types:

  • Text
  • JSON
  • Number
  • Boolean
  • Datetime
  • Date
  • Time
  • Array
  • Foreign key
  • UUID

By default, the attribute type is Text. If the database column represents a foreign key, the type will be Foreign key. Otherwise, see the following mapping of database column type to attribute type:

Database column types to attribute types

Attribute typeUnderlying database column type
JSON
jsonjsonb
Number
tinyintsmallintintintegermediumintbigintdecimaldoublefloatnumericrealdouble precisionsmallserialserialbigserialmoney
Boolean
booleanbit
Datetime
datetimetimestamptimestamptz
Date
date
Time
time
Array
array
Uuid
uuid

Display as

Depending on the attribute type, you can choose to view an attribute’s value in different ways.

Text attributes

image
  • Text The default view option for text attributes.
  • Rich text If your text is written as HTML or markdown, then Basedash will be able to do things such as show bold and italicized text, lists, and more.
  • JSON A JSON editor will be used and proper syntax highlighting will be used.
  • Image If the text value is a URL, then Basedash will display the image corresponding to that URL if the “Image” view option is selected.
  • File upload Allows you to upload a file to an file upload connection.

Number attributes

image
  • Number The default view option for number attributes.
  • Checkbox Will represent 0s as unchecked and other numbers as being checked. If checking an unchecked value, the value will be set to 1.

Display attributes vs primary keys

You may be familiar with primary keys, which are values in your database that are used to uniquely identify a record. Basedash introduces display attributes to allow your data to be more understandable when viewed in Basedash.

First, let’s explain what primary keys are used for in databases.

Primary keys

For example, let’s take the given database table for users.

image

The database table may have been setup to use the id column as the primary key. This primary key can be used in the database when you want to reference a user from another table.

Let’s introduce two new tables to illustrate this: teams and team_members.

image
image

In the team_members table, the team_id and user_id columns are foreign keys pointing towards the teams and users tables, respectively. A foreign key is a column or a set of columns in a table whose values correspond to the values of the primary key in another table.

The team_members table isn’t really all that useful to look at by itself since you need to do a lot of cross referencing between the teams table and users table in order to figure out which team/user corresponds with the foreign key value in the team_id/user_id columns.

That’s where display attributes become useful within Basedash.

Display attributes

In Basedash, we allow you to specify columns as display attributes. Values in the display attribute columns will be used in the Basedash UI to represent foreign key values, instead of the primary key.

Continuing with our example from above, let’s set a display attribute on the users table to be email and a display attribute on the teams table to be name. Notice how to column header icon changes to indicate the column is now the display attribute.

image
image

Now, our team_members table will show the display attribute values for the foreign keys that point to the users and teams tables, making the table more easily understandable without the need for cross-referencing table data.

image

Display attribute columns will be sticky columns that will stick to the left side of a table layout, even when scrolling horizontally. If no display attribute is set on a table, the sticky column will be the primary key column on the table.

Manually set display attributes

To mark a column as a display attribute, navigate to the table settings for a data source and select the display attribute from a dropdown.

image

Automatically set display attributes

By default, Basedash will automatically mark a column as a display attribute if it has one of the following names:

  • Name
  • Full name
  • First name
  • Username
  • Email
  • Title

The above names are ordered in priority, so if a table contains both Name and Email columns, the Name column will be marked as the display attribute.

Email attributes

If you have a database column with the word “email” in it and it is a string/text column, then you will have the option when configuring your view to display a “Send email” button for records. This will allow a “Send email” button to show up when viewing a record and that button will open a new email draft in your email client with the “to” address prefilled with the record email.

image
image

Display names

When displaying names of attributes and tables in the Basedash user interface, it’s possible to give them names that differ from the underlying name used in your database in order to make them more “human friendly”. For example, you might want to get rid of underscores or add spaces in your names.

When adding a new connection, Basedash will automatically “prettify” all your table and attribute names so that they appear in a more “human friendly” way in the user interface. You can change the display name for an attribute in the connection configuration pages.

Obscured attributes

It’s possible to mark attributes as “obscured” which will prevent the real value from being visible in the user interface. Obscured attributes are also not even sent through via API calls, but rather a random hash of characters is used instead so that obscured attributes cannot be accessed by users.

Upon adding a new connection, Basedash will automatically obscure attributes that correspond with the following database column names (case insensitive):

  • password
  • passphrase
  • secret
  • apiKey
  • api_key

You can change the display name for an attribute in the connection configuration pages.

Our own custom Basehash font is used when displaying obscured data.

image