↓ Skip to main content

Buffer Analytics SQLite Schema Reference #

The Buffer Analytics database is created and maintained automatically by scripts/buffer_analytics.py. Database tables, indexes, and analytical views are provisioned during sync operations.


1. Relational Tables #

channels #

Stores connected social media channel profiles and account configuration.

ColumnTypeConstraintsDescription
idTEXTPRIMARY KEYUnique Buffer channel ID (e.g. 1234567890abcdef12345678)
organization_idTEXTBuffer organization ID
nameTEXTChannel handle / username
serviceTEXTSocial network (linkedin, twitter, bluesky, instagram, facebook)
display_nameTEXTFormatted account display name
timezoneTEXTAccount timezone string (e.g. UTC, America/New_York)
is_disconnectedINTEGERDEFAULT 01 if account is disconnected
is_lockedINTEGERDEFAULT 01 if account is locked by plan limits
is_queue_pausedINTEGERDEFAULT 01 if publishing queue is paused
avatar_urlTEXTURL of profile picture
external_linkTEXTURL of the social media profile
raw_jsonTEXTNOT NULLComplete raw JSON payload from Buffer API
created_atTEXTISO-8601 creation timestamp
updated_atTEXTISO-8601 modification timestamp
synced_atTEXTNOT NULLTimestamp of local database sync

posts #

Stores individual social media posts, scheduling lifecycle status, and text content.

ColumnTypeConstraintsDescription
idTEXTPRIMARY KEYUnique Buffer post ID
organization_idTEXTBuffer organization ID
channel_idTEXTNOT NULL, FK -> channels(id)Associated social channel ID
channel_serviceTEXTService name (linkedin, twitter, bluesky)
statusTEXTNOT NULLPost status (sent, scheduled, draft, error)
textTEXTFull text copy of the post
external_linkTEXTURL of the live published post on the network
sent_atTEXTISO-8601 publication timestamp
due_atTEXTScheduled publication timestamp
created_atTEXTCreation timestamp
updated_atTEXTModification timestamp
scheduling_typeTEXTScheduling method (queue, custom_time, share_now)
is_ai_generatedINTEGERDEFAULT 01 if marked AI generated in Buffer
thread_countINTEGERDEFAULT 0Number of posts in thread
first_commentTEXTScheduled first comment text
char_countINTEGERTotal character count of post body
word_countINTEGERTotal word count of post body
has_linkINTEGERDEFAULT 01 if post contains URLs or external links
has_mediaINTEGERDEFAULT 01 if post contains image or video attachments
raw_jsonTEXTNOT NULLComplete raw JSON payload from Buffer API
synced_atTEXTNOT NULLTimestamp of local database sync

post_metrics #

Stores normalized engagement metrics recorded per post.

ColumnTypeConstraintsDescription
idINTEGERPRIMARY KEY AUTOINCREMENTUnique metric record ID
post_idTEXTNOT NULL, FK -> posts(id)Associated post ID
channel_idTEXTAssociated channel ID
channel_serviceTEXTService name (linkedin, twitter, bluesky)
metric_typeTEXTNOT NULLMetric key (impressions, reach, reactions, comments, reposts, clicks, engagementRate)
nameTEXTHuman-readable metric name
valueREALNOT NULL, DEFAULT 0Metric numeric value
unitTEXTUnit (count, percentage)
descriptionTEXTMetric description
recorded_atTEXTTimestamp recorded by Buffer
synced_atTEXTNOT NULLTimestamp of local database sync

post_assets #

Stores media attachments (images, videos, thumbnails) linked to posts.

ColumnTypeConstraintsDescription
idTEXTPRIMARY KEYAsset identifier or URL hash
post_idTEXTNOT NULL, FK -> posts(id)Associated post ID
typeTEXTMedia type (image, video, gif)
mime_typeTEXTMIME format (e.g. image/png, video/mp4)
sourceTEXTFull-resolution asset URL
thumbnailTEXTThumbnail asset URL
raw_jsonTEXTComplete asset JSON payload

post_tags #

Stores organizational tags and campaign labels assigned in Buffer.

ColumnTypeConstraintsDescription
idTEXTPRIMARY KEY (post_id, id)Tag identifier
post_idTEXTPRIMARY KEY (post_id, id), FK -> posts(id)Associated post ID
nameTEXTTag name / label
colorTEXTHex color code

sync_history #

Audit log recording every backfill and incremental sync operation.

ColumnTypeConstraintsDescription
idINTEGERPRIMARY KEY AUTOINCREMENTUnique sync run ID
organization_idTEXTBuffer organization ID
channel_idTEXTSpecific channel ID if scoped
sync_modeTEXTNOT NULLSync type (incremental, full)
start_dateTEXTStarting date of sync window
end_dateTEXTEnding date of sync window
posts_fetchedINTEGERDEFAULT 0Count of records fetched from API
posts_insertedINTEGERDEFAULT 0Count of newly inserted posts
posts_updatedINTEGERDEFAULT 0Count of existing posts refreshed
started_atTEXTNOT NULLStart timestamp
finished_atTEXTCompletion timestamp
statusTEXTNOT NULLStatus (success, failed, running)
error_messageTEXTError details if failed

2. Analytical SQL Views #

v_posts_summary #

Primary analytical view flattening posts with pivoted metrics, engagement rate calculations, and temporal calendar dimensions.

ColumnTypeDescription
post_idTEXTUnique post ID
serviceTEXTSocial network (linkedin, twitter, bluesky)
channel_nameTEXTChannel username / handle
statusTEXTPost status (sent, scheduled, draft)
sent_atTEXTFull ISO timestamp of publication
sent_dateTEXTDate string (YYYY-MM-DD)
year_monthTEXTYear and month string (YYYY-MM)
day_of_weekTEXTFull day name (Monday, Tuesday, Wednesday, etc.)
hour_of_dayINTEGERUTC hour of publication (0 to 23)
char_countINTEGERBody text character count
word_countINTEGERBody text word count
has_linkINTEGER1 if external links are present in text
has_mediaINTEGER1 if image or video attachments are present
thread_countINTEGERNumber of posts in thread
external_linkTEXTLive social network URL
textTEXTFull text copy of post
impressionsREALTotal post views / impressions
reachREALUnique viewers reached
reactionsREALTotal likes and reactions
commentsREALTotal comments received
repostsREALTotal retweets / reshares
clicksREALTotal link clicks
engagement_rateREALOverall engagement percentage