Get Foreign Keys
get_foreign_keysGet foreign key relationships for a Magento table from INFORMATION_SCHEMA to understand referential links before constructing JOIN queries.
Instructions
Returns foreign key relationships for a table from INFORMATION_SCHEMA. Use before writing JOINs to understand referential links. Use describe_table for column details.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table | Yes | Magento database table name (e.g. sales_order, catalog_product_entity). | |
| profile | No | Override the MAGENTO_SQL_PROFILE env var for this call only. Use list_connection_profiles to see available names. | |
| magentoRoot | No | Absolute path to the Magento root (must contain app/etc/env.php). Defaults to MAGENTO_ROOT env var or auto-discovery. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note | No | ||
| rows | Yes | ||
| sampled | No | ||
| rowCount | Yes | ||
| truncated | No |