Implementation:Mage ai Mage ai Twitter Ads Tweets Schema
| Knowledge Sources | |
|---|---|
| Domains | Data_Integration, Twitter_Ads, Schema |
| Last Updated | 2026-02-09 00:00 GMT |
Overview
JSON Schema definition for Twitter Ads tweet records used by the Singer-based Twitter Ads source connector.
Description
This schema defines the structure and types for tweet data extracted from the Twitter Ads API. It is loaded by the Twitter Ads source connector during stream discovery to validate and type-check extracted records. The schema follows the JSON Schema specification with additionalProperties set to false and includes top-level properties such as account_id, id, tweet_type, id_str, created_at (date-time format), text, source, truncated, in_reply_to_status_id, in_reply_to_status_id_str, in_reply_to_user_id, in_reply_to_user_id_str, in_reply_to_screen_name, user (a nested object with user profile fields, also with additionalProperties false), and coordinates. The root type is ["null", "object"], allowing nullable records.
Usage
This schema is automatically loaded by the Twitter Ads source connector during the discovery phase. It defines the available columns and their types for the tweets stream.
Code Reference
Source Location
- Repository: mage-ai
- File: mage_integrations/mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/tweets.json
- Lines: 1-920
Signature
{
"type": ["null", "object"],
"additionalProperties": false,
"properties": {
"account_id": { "type": ["null", "string"] },
"id": { "type": ["null", "integer"] },
"tweet_type": { "type": ["null", "string"] },
"id_str": { "type": ["null", "string"] },
"created_at": { "type": ["null", "string"], "format": "date-time" },
"text": { "type": ["null", "string"] },
"source": { "type": ["null", "string"] },
"truncated": { "type": ["null", "boolean"] },
"in_reply_to_status_id": { "type": ["null", "integer"] },
"in_reply_to_user_id": { "type": ["null", "integer"] },
"in_reply_to_screen_name": { "type": ["null", "string"] },
"user": { "type": ["null", "object"], "additionalProperties": false, "properties": { "id": {}, "..." : "..." } },
"coordinates": { "type": ["null", "object"], "..." : "..." }
}
}
Import
# Loaded automatically by Source.load_schemas_from_folder()
# Path: mage_integrations/mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/tweets.json
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| (none) | JSON file | Yes | Loaded from disk by schema loader |
Outputs
| Name | Type | Description |
|---|---|---|
| schema | dict | JSON Schema object with properties, types, and format constraints |
Usage Examples
import json
import os
schema_path = os.path.join(
"mage_integrations/mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas",
"tweets.json"
)
with open(schema_path) as f:
schema = json.load(f)
print(list(schema["properties"].keys()))