Understanding data preview & query
After you connect and select a database, schema, or SaaS connection, Mammoth opens the query and preview screen. This is where you choose what data to bring in—by selecting a table or writing a SQL query—and preview a sample of the results before saving your dataset.
Query and preview screen layout
The query and preview screen has three areas:
Left panel: List of tables
A scrollable list of the tables available through your connection. Click any table name to load it into the query editor and run an automatic preview. Use the search icon to filter the list.
Center: query editor
The SQL query that defines what data Mammoth will import. When you click a table, Mammoth loads a SELECT * query for that table here. Click the edit icon to change the query or write your own.
Right: preview grid
A preview of the rows returned by your query, under the Preview heading. This shows the columns that will be imported into your dataset.
Select a table
- In the List of tables panel, scroll or search for your table
- Click the table name—Mammoth generates a default query and runs a preview automatically
- The preview grid on the right populates with sample data
You can select a different table at any time by clicking it in the left panel. The query and preview update automatically.
Write a custom query
The default query selects all rows and columns from the chosen table. To import a subset of data:
-
Click the query text or the edit icon to open the query editor. Mammoth warns that editing the query changes the structure of your data and could cause errors in Views that depend on it
-
Modify the SQL to filter rows, select specific columns, or join tables:
SELECT id, name, email, created_at FROM customers WHERE created_at >= '2024-01-01' ORDER BY created_at DESCUse the table and column names from your own source.
-
Click Run to execute the query and refresh the preview
Tip: Filter in the query. Filter rows in your query rather than importing everything and filtering later. Importing less data makes your dataset faster to refresh and cheaper on your source system. See Connector performance & best practices for more tips.
AI query generation
For supported connectors, when enabled for your workspace, you can describe what data you want in plain language and Mammoth writes the SQL query for you.
Connectors that support AI query generation
- PostgreSQL
- MySQL
- SQL Server
- SAP HANA
- HubSpot
- Xero
Generate a query with AI
- In the Describe the data you need... box above the query editor, type what you want—for example: "all customers who signed up in the last 30 days"
- Click the AI button next to the box (or press Enter)
- Mammoth analyses your table structure and writes a SQL query. The box is disabled while Mammoth sets up metadata for AI query
- Review the generated query, then click Run to preview the results
- Edit the query if needed before saving
AI query generation builds on your table structure. Mammoth analyses the column names and types in your selected table to generate accurate queries. For best results, select a table first, then describe your intent. If the generated query isn't quite right, you can edit it directly before running.
If the Describe the data you need... box isn't visible, AI query generation isn't enabled for your workspace or isn't available for your connector—use the query editor directly.
Read the preview grid
The preview grid shows a sample of your query result so you can verify your data looks correct before saving.
What the preview shows
- Column names as they appear in your source system
- Actual data values—check these against what you expect
When the preview is loading
Mammoth shows "Loading Preview" while it queries your source.
When no data appears
- Before you pick a table, the grid says "Select table or run a query to preview data"
- If the list says "No tables were found", the connection has no tables the user can see—check the user's permissions in the source
- If the query fails, Mammoth shows "The query did not return results" with the error message below the query editor—check your
WHEREclause and syntax
Save the dataset
When the preview looks right, save your dataset at the bottom of the screen:
Dataset name
Enter a name for your dataset in the Save table as field. This is how it will appear in your Data Library. Choose something descriptive—for example, "Salesforce Contacts" or "PostgreSQL Orders 2024".
Update method
The Update Method controls what happens to your dataset when it is refreshed (via scheduled automation or manual refresh). The default is Replace all data. To change it, click the edit icon next to the update method, pick an option, and click Save changes:
| Method | What it does | When to use |
|---|---|---|
| Replace all data | Replaces all existing data with the full query result fresh | Snapshots, lookup tables, full refreshes where all data is replaced |
| Add new data | Adds new data based on a unique sequential column without modifying existing rows | Incremental imports where only new records are added |
| Replace with new data | Replaces existing data with new data based on a unique sequential column | Updates to existing records with ability to track changes |
Use Replace all data for complete data replacements. Use Add new data for appending-only scenarios. Use Replace with new data when you need to update specific records based on a unique identifier.
For Add new data and Replace with new data, also choose a Key column—a numeric or date column with incrementing values, such as an ID or a date.
Click Save as dataset. When the dataset is saved, click Done to return to your Data Library.
File connectors (Google Drive, Dropbox, SFTP, and similar) don't use this screen: you select a file and click Create new dataset.
After saving
Your connector dataset is now in your Data Library. To keep it up to date, set up a Dataset Refresh automation—this re-runs your query on a schedule and updates the dataset according to its update method. See Scheduling & automation to get started.