Prerequisites
Before proceeding, ensure the following prerequisites are met:- Install MindsDB locally via Docker or Docker Desktop.
- Enable Token-Based Authentication (TBA) and REST Web Services in NetSuite:
- Setup > Company > Enable Features > SuiteCloud tab
- Check “Token-Based Authentication” and “REST Web Services”
Connection
Establish a connection to NetSuite from MindsDB by executing the following SQL command and providing its handler name as an engine.account_id: NetSuite account/realm ID (e.g.123456_SB1)consumer_key: Integration consumer keyconsumer_secret: Integration consumer secrettoken_id: Access token IDtoken_secret: Access token secret
rest_domain: Override REST domain from Company Information (REST Web Services URL)record_types: Comma-separated record types to expose as tables (defaults to this list)
Token-Based Authentication setup
To create the required credentials in NetSuite:- Create an Integration record: Setup > Integrations > Manage Integrations > New. Enable Token-Based Authentication.
- Create/choose a role for the integration and grant:
- Setup > REST Web Services (Full)
- Setup > User Access Tokens (Full)
- Record-level permissions you will query (e.g., Transactions > Sales Order, Lists > Customers).
- Assign that role to the user.
- Generate an Access Token: Setup > Users/Roles > Access Tokens > New.
- Copy the Consumer Key/Secret and Token ID/Secret.
Usage
Retrieve data from a record table:- Use
WHERE id = ...(orinternalId) to fetch a full record directly. - Other filters are pushed down as
qwhere possible; remaining filters are applied locally.
Use the
rest_domain parameter if your account uses a REST domain that differs from the default derived from account_id.Access to both REST record tables and SuiteQL depends on the NetSuite role tied to your access token.
If a query fails with 403/permission errors, ensure the role includes REST Web Services, User Access Tokens, and record-specific permissions for the tables you are querying (plus SuiteAnalytics permissions for SuiteQL).