Tableau Connector for Square

Build 26.0.9770

CatalogMeasurementUnits

Create, update, and query catalog measurement unit objects in Square. Measurement units define how item quantities are measured and displayed.

Table Specific Information

CatalogMeasurementUnits returns only the MEASUREMENT_UNIT objects in the Square catalog. These objects define the units of measurement (such as ounces, grams, or liters) that can be used for other catalog objects.

The Catalog table is the generic counterpart. It returns objects of every catalog type in a single result set, and rather than giving each type its own columns it carries the type specific fields as a JSON document in the column matching the row type: ItemData for an item, MeasurementUnitData for a measurement unit, and so on. Use Catalog to search across types or when the type is not known in advance, and use CatalogMeasurementUnits or another type specific table to work with one type through individual columns. Catalog is read-only, while the type specific tables also support INSERT, UPDATE, and DELETE.

Because CatalogMeasurementUnits is restricted to MEASUREMENT_UNIT objects, a search that matches only other catalog types returns no rows here. Run the same search against Catalog to see those matches.

Select

The connector uses the Square API to filter the results by the following columns and operators while the rest of the filter is executed client-side within the connector.

  • Id supports the following operators: =, IN.
  • IncludeDeletedObjects supports the following operator: =.
  • Query supports the following operator: =.
  • SearchText supports the following operators: =, IN.
  • UpdatedAt supports the following operator: >.

Retrieve all catalog measurement units:

SELECT * FROM CatalogMeasurementUnits

Filter on Id to retrieve specific measurement units. Id = fetches a single measurement unit directly. Id IN is served by the batch retrieve endpoint in a single request rather than one request per Id; the endpoint takes up to 1000 Ids per request, so a longer list is split across as many requests as needed.

SELECT Id, MeasurementUnitType FROM CatalogMeasurementUnits WHERE Id = 'unit_1'

SELECT Id, MeasurementUnitType FROM CatalogMeasurementUnits WHERE Id IN ('unit_1', 'unit_2')

UpdatedAt supports only the > operator, which Square applies as the start of the search window. Equality and the upper bound operators are not supported.

SELECT Id, MeasurementUnitType, UpdatedAt FROM CatalogMeasurementUnits WHERE UpdatedAt > '2025-01-01T00:00:00Z'

Set IncludeDeletedObjects to true to return measurement units that have been deleted. A deleted measurement unit reports IsDeleted as true.

SELECT Id, MeasurementUnitType, IsDeleted FROM CatalogMeasurementUnits WHERE IncludeDeletedObjects = true

SearchText searches the searchable attributes, such as name and description. Matching is case-insensitive, and keywords of fewer than three alphanumeric characters are ignored.

SELECT Id FROM CatalogMeasurementUnits WHERE SearchText = 'Pound'

Use IN to supply up to three keywords. Square combines them with AND and matches them in any order. Square rejects a fourth keyword with the error ARRAY_LENGTH_TOO_LONG, reporting that the collection must have at most 3 items.

SELECT Id FROM CatalogMeasurementUnits WHERE SearchText IN ('Pound', 'Weight')

The Query column takes a Square CatalogQuery object, supplied as JSON, and gives access to every search Square offers. The following search types are available.

  • exact_query matches an attribute against an exact value. Takes attribute_name and attribute_value.
  • prefix_query matches an attribute against a leading substring. Takes attribute_name and attribute_prefix.
  • range_query matches a numeric attribute against a range. Takes attribute_name, attribute_min_value, and attribute_max_value.
  • sorted_attribute_query orders the results by an attribute. Takes attribute_name, sort_order, and optionally initial_attribute_value.
  • set_query matches an attribute against any value in a set. Takes attribute_name and attribute_values.
  • items_for_tax_query returns the items that use the given taxes. Takes tax_ids.
  • items_for_modifier_list_query returns the items that use the given modifier lists. Takes modifier_list_ids.
  • items_for_item_options_query returns the items that use the given item options. Takes item_option_ids.
  • item_variations_for_item_option_values_query returns the item variations that carry the given item option values. Takes item_option_value_ids.
  • modifiers_for_child_list_query returns the modifiers that nest the given modifier lists, matching a modifier whose child_modifier_list_ids contains any of the supplied IDs. Takes child_modifier_list_ids. This search type is in beta.

exact_query, prefix_query, range_query, and sorted_attribute_query may be set together in a single CatalogQuery. Each of set_query, items_for_tax_query, items_for_modifier_list_query, items_for_item_options_query, item_variations_for_item_option_values_query, and modifiers_for_child_list_query must be the only search type in the object.

Do not set text_query in the Query column if SearchText is also set: both write to the same search, and connector rejects the combination with an error instead of merging them. Express the whole text_query search inside the Query value, or drop it and filter with SearchText alone.

Because this table returns only MEASUREMENT_UNIT objects, a search type that yields another catalog type produces no rows here even when it matches. items_for_tax_query, items_for_modifier_list_query, items_for_item_options_query, item_variations_for_item_option_values_query, and modifiers_for_child_list_query return other catalog types, so run those against Catalog or the appropriate type-specific tables.

Order the results by an attribute. Square preserves this ordering in the result set.

SELECT Id, MeasurementUnitType FROM CatalogMeasurementUnits WHERE Query = '{"sorted_attribute_query":{"attribute_name":"name","sort_order":"ASC"}}'

The filters can be combined in a single WHERE clause. The connector merges them into one request, with SearchText folded into the CatalogQuery next to whatever the Query column supplies.

SELECT Id FROM CatalogMeasurementUnits WHERE SearchText = 'Pound' AND Query = '{"sorted_attribute_query":{"attribute_name":"name","sort_order":"ASC"}}' AND IncludeDeletedObjects = true

Insert

To create a catalog measurement unit, you must specify the Id column. Use MeasurementUnitType to specify the type of measurement and the corresponding unit field.

INSERT INTO CatalogMeasurementUnits (Id, MeasurementUnitType, WeightUnit, Precision) VALUES ('#new-measurement-unit', 'TYPE_WEIGHT', 'IMPERIAL_POUND', 2)

Update

Modify the details of an existing catalog measurement unit by providing the Id. When updating, provide the Version to match the current version in the database.

UPDATE CatalogMeasurementUnits SET Precision = 3, Version = 1 WHERE Id = 'measurement_unit_id_here'

Delete

Delete a catalog measurement unit by providing the Id:

DELETE FROM CatalogMeasurementUnits WHERE Id = 'measurement_unit_id_here'

Bulk Delete

The maximum BatchSize supported by CatalogMeasurementUnits for a delete is 200. Note that this is lower than the 1000 Ids a batch retrieve accepts, because Square caps its catalog batch delete separately.

Stage the Ids of the measurement units to remove in a TEMP table, then delete them in a single request. Only the Id is needed on each staged row, and a row that supplies no Id is rejected before the request is sent.

INSERT INTO CatalogMeasurementUnits#TEMP (Id) VALUES ('unit_1')

INSERT INTO CatalogMeasurementUnits#TEMP (Id) VALUES ('unit_2')

DELETE FROM CatalogMeasurementUnits WHERE EXISTS SELECT Id FROM CatalogMeasurementUnits#TEMP

A catalog batch delete succeeds even when only some of the Ids could be removed, and Square answers with the Ids it actually deleted. The connector reports the outcome of every staged Id against that list, so query LastResultInfo#TEMP after the delete to see which rows were removed and which were not.

SELECT * FROM LastResultInfo#TEMP

Note: The staged form shown above is required to reach the bulk delete endpoint. A DELETE FROM CatalogMeasurementUnits WHERE Id = '...' statement removes the same measurement unit but issues one request per Id.

Columns

Name Type ReadOnly Description
Id [KEY] String False

The measurement unit's ID.

UpdatedAt Datetime True

Date and time when the measurement unit was last modified.

IsDeleted Boolean False

If true, the object has been deleted from the database.

Version Int64 False

The version of the object. When updating, the version supplied must match the version in the database.

PresentAtAllLocations Boolean False

If true, this object is present at all locations.

PresentAtLocationIds String False

A list of locations where the object is present.

AbsentAtLocationIds String False

A list of locations where the object is not present.

MeasurementUnitType String False

The type of unit being represented.

The allowed values are TYPE_CUSTOM, TYPE_AREA, TYPE_LENGTH, TYPE_VOLUME, TYPE_WEIGHT, TYPE_GENERIC, TYPE_TIME.

CustomUnitName String False

The name of the custom unit of measurement.

CustomUnitAbbreviation String False

The abbreviation of the custom unit.

AreaUnit String False

The area unit for TYPE_AREA measurements (e.g., IMPERIAL_SQUARE_FOOT, METRIC_SQUARE_METER).

The allowed values are IMPERIAL_SQUARE_INCH, IMPERIAL_SQUARE_FOOT, IMPERIAL_SQUARE_YARD, IMPERIAL_SQUARE_MILE, METRIC_SQUARE_CENTIMETER, METRIC_SQUARE_METER, METRIC_SQUARE_KILOMETER.

LengthUnit String False

The length unit for TYPE_LENGTH measurements (e.g., IMPERIAL_INCH, METRIC_METER).

The allowed values are IMPERIAL_INCH, IMPERIAL_FOOT, IMPERIAL_YARD, IMPERIAL_MILE, METRIC_MILLIMETER, METRIC_CENTIMETER, METRIC_METER, METRIC_KILOMETER.

VolumeUnit String False

The volume unit for TYPE_VOLUME measurements (e.g., IMPERIAL_FLUID_OUNCE, METRIC_LITER).

The allowed values are GENERIC_FLUID_OUNCE, GENERIC_SHOT, GENERIC_CUP, GENERIC_PINT, GENERIC_QUART, GENERIC_GALLON, IMPERIAL_CUBIC_INCH, IMPERIAL_CUBIC_FOOT, IMPERIAL_CUBIC_YARD, METRIC_MILLILITER, METRIC_LITER.

WeightUnit String False

The weight unit for TYPE_WEIGHT measurements (e.g., IMPERIAL_POUND, METRIC_KILOGRAM).

The allowed values are IMPERIAL_WEIGHT_OUNCE, IMPERIAL_POUND, IMPERIAL_STONE, METRIC_MILLIGRAM, METRIC_GRAM, METRIC_KILOGRAM.

GenericUnit String False

The generic unit for TYPE_GENERIC measurements.

The allowed values are UNIT.

TimeUnit String False

The time unit for time measurements.

The allowed values are GENERIC_MILLISECOND, GENERIC_SECOND, GENERIC_MINUTE, GENERIC_HOUR, GENERIC_DAY.

Precision Integer False

The precision to show when displaying the unit. Supported values are 0, 1, 2, 3, 4, and 5.

CreatedAt Datetime True

Date and time when the measurement unit was first created in the catalog.

Pseudocolumns

Pseudo column fields are used in the WHERE clause of SELECT statements (unless stated otherwise) and offer a more granular control over the tuples that are returned from the data source.

Name Type Description
IncludeDeletedObjects Boolean

If true, deleted objects are included in results.

SearchText String

A keyword to search for across the searchable attributes of a catalog object, such as name, description, and SKU. Matching is case-insensitive, and keywords of fewer than three alphanumeric characters are ignored. Use IN to supply up to three keywords, which are combined with AND in any order; Square rejects a fourth.

Query String

A Square CatalogQuery object, supplied as JSON, giving full access to every search Square offers. Any of exact_query, prefix_query, range_query, sorted_attribute_query, and text_query may be set together. Each of set_query, items_for_tax_query, items_for_modifier_list_query, items_for_item_options_query, item_variations_for_item_option_values_query, and modifiers_for_child_list_query must be the only search set. This table returns only MEASUREMENT_UNIT objects, so a search that matches other catalog types returns no rows. Do not set text_query here; this table builds it from the SearchText column.

Copyright (c) 2026 CData Software, Inc. - All rights reserved.
Build 26.0.9770