Dataset Viewer

The dataset viewer is not available because its heuristics could not detect any supported data files. You can try uploading some data files, or configuring the data files location manually.

YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

sec_fsnds

A ready-to-run SQL Server database of the SEC Financial Statement and Notes Data Sets (FSNDS), packaged with a Docker image, installer script, stored procedures, and recommended indexes.

This is the full historical FSNDS corpus (all quarterly dumps the SEC has published) loaded into a single, normalized SQL Server database. The data file is ~300 GB on disk.


What's in this package

sec_fsnds_package/
├── README.md                       -- this file
├── Dockerfile                      -- SQL Server 2022 + Full-Text Search
├── docker-compose.yaml             -- parameterized compose file
├── sec_fsnds_setup.cmd             -- Windows installer (interactive)
└── sql/
    ├── schema/
    │   └── sec_fsnds_schema.md     -- table / column / index reference
    ├── indexes/
    │   └── sec_fsnds_recommended_indexes.sql
    ├── sps/
    │   ├── usp_fsnds_get_statement.sql
    │   ├── usp_fsnds_get_statement_series_combined.sql
    │   ├── usp_fsnds_get_statement_series_quarterly.sql
    │   ├── usp_sec_find_filings_by_cik.sql
    │   ├── usp_sec_find_filings_by_name.sql
    │   ├── usp_sec_find_tag.sql
    │   ├── usp_sec_get_filing_metadata.sql
    │   ├── usp_sec_get_full_filing.sql
    │   ├── usp_sec_get_segment_values.sql
    │   ├── usp_sec_get_tag_history.sql
    │   ├── usp_sec_get_tag_usage.sql
    │   ├── usp_sec_get_text_facts.sql
    │   ├── usp_sec_list_peers.sql
    │   └── usp_sec_peer_analysis.sql
    └── validation/
        └── usp_sec_validate_statement_integrity.sql

Requirements

  • Docker Desktop (Windows / macOS / Linux) or Docker Engine + Compose v2
  • ~350 GB free disk space on the drive that will hold the database files
  • At least 4 GB RAM available to the container (8+ GB recommended)
  • curl available on the host (Windows 10 / 11 ship with it in System32)
  • A SQL Server client: sqlcmd, Azure Data Studio, or SSMS

Quick start (Windows)

  1. Create an empty folder somewhere, e.g. C:\sec_fsnds.

  2. Copy sec_fsnds_setup.cmd into that folder and run it.

  3. Answer the prompts:

    • SA password for the database
    • Host port (default 1434; change it if 1434 is in use)
    • Container name (default mssql-sec-fsnds)
    • Host data directory (must exist and have 350 GB free)
    • SQL Server edition (Developer, Express, Standard, Enterprise)
  4. The script downloads Dockerfile, docker-compose.yaml, sec_fsnds.mdf, and sec_fsnds_log.ldf from Hugging Face. The .mdf download is the large one and supports resume via curl -C - if interrupted.

  5. When downloads finish, run:

    docker compose up -d --build
    

    from the same folder.

  6. Connect with sqlcmd or your favorite client:

    sqlcmd -S localhost,1434 -U sa -P "<your password>" -d sec_fsnds -Q "SELECT TOP 5 adsh, cik, name FROM dbo.sub ORDER BY filed DESC"
    

Quick start (macOS / Linux)

The .cmd installer is Windows-only, but the docker-compose.yaml is portable. Steps:

  1. Download Dockerfile, docker-compose.yaml, sec_fsnds.mdf, sec_fsnds_log.ldf from the Hugging Face repo (same URLs the installer uses, see sec_fsnds_setup.cmd).

  2. Create a .env file in the same folder:

    ACCEPT_EULA=Y
    MSSQL_SA_PASSWORD=<pick a strong password>
    MSSQL_PID=Developer
    HOST_PORT=1434
    CONTAINER_NAME=mssql-sec-fsnds
    HOST_DATA_DIR=/absolute/path/to/data/folder
    
  3. Put the .mdf and .ldf files in HOST_DATA_DIR.

  4. docker compose up -d --build


After first start

On first start, SQL Server attaches sec_fsnds.mdf and sec_fsnds_log.ldf automatically via the pre-populated master database inside the container image. Give it a minute to warm up, then verify:

SELECT name, state_desc FROM sys.databases WHERE name = 'sec_fsnds';

You should see sec_fsnds in state ONLINE.

Install the stored procedures

From the package folder:

sqlcmd -S localhost,1434 -U sa -P "<pw>" -d sec_fsnds -i sql/sps/usp_fsnds_get_statement.sql
sqlcmd -S localhost,1434 -U sa -P "<pw>" -d sec_fsnds -i sql/sps/usp_fsnds_get_statement_series_combined.sql
sqlcmd -S localhost,1434 -U sa -P "<pw>" -d sec_fsnds -i sql/sps/usp_fsnds_get_statement_series_quarterly.sql
sqlcmd -S localhost,1434 -U sa -P "<pw>" -d sec_fsnds -i sql/sps/usp_sec_find_filings_by_cik.sql
sqlcmd -S localhost,1434 -U sa -P "<pw>" -d sec_fsnds -i sql/sps/usp_sec_find_filings_by_name.sql
sqlcmd -S localhost,1434 -U sa -P "<pw>" -d sec_fsnds -i sql/sps/usp_sec_find_tag.sql
sqlcmd -S localhost,1434 -U sa -P "<pw>" -d sec_fsnds -i sql/sps/usp_sec_get_filing_metadata.sql
sqlcmd -S localhost,1434 -U sa -P "<pw>" -d sec_fsnds -i sql/sps/usp_sec_get_full_filing.sql
sqlcmd -S localhost,1434 -U sa -P "<pw>" -d sec_fsnds -i sql/sps/usp_sec_get_segment_values.sql
sqlcmd -S localhost,1434 -U sa -P "<pw>" -d sec_fsnds -i sql/sps/usp_sec_get_tag_history.sql
sqlcmd -S localhost,1434 -U sa -P "<pw>" -d sec_fsnds -i sql/sps/usp_sec_get_tag_usage.sql
sqlcmd -S localhost,1434 -U sa -P "<pw>" -d sec_fsnds -i sql/sps/usp_sec_get_text_facts.sql
sqlcmd -S localhost,1434 -U sa -P "<pw>" -d sec_fsnds -i sql/sps/usp_sec_list_peers.sql
sqlcmd -S localhost,1434 -U sa -P "<pw>" -d sec_fsnds -i sql/sps/usp_sec_peer_analysis.sql
sqlcmd -S localhost,1434 -U sa -P "<pw>" -d sec_fsnds -i sql/validation/usp_sec_validate_statement_integrity.sql

Each file is idempotent (IF OBJECT_ID ... DROP, then CREATE).

Install recommended indexes (optional but recommended)

sqlcmd -S localhost,1434 -U sa -P "<pw>" -d sec_fsnds -i sql/indexes/sec_fsnds_recommended_indexes.sql

Read the header comment in that file first. Two of the indexes are large (several GB) and take 10-45 minutes to build. Everything in the sql/sps/ set works without them, just slower for certain queries.


What the stored procedures do

Statement retrieval

SP What it returns
usp_fsnds_get_statement Single BS/IS/CF for one filing, optional comparative
usp_fsnds_get_statement_series_combined Wide pivot across 10-Ks and 10-Qs, raw as-reported
usp_fsnds_get_statement_series_quarterly Wide pivot with Q4 derived (10-K minus Q1+Q2+Q3)

Filing discovery

SP What it returns
usp_sec_find_filings_by_cik All filings by CIK, filter by form / date
usp_sec_find_filings_by_name Companies whose name matches a LIKE pattern
usp_sec_get_filing_metadata sub row + pre/num/txt row counts for one filing
usp_sec_get_full_filing Every line of every statement in a filing, stacked

Tag exploration

SP What it returns
usp_sec_find_tag Tag name search, optionally including tag text
usp_sec_get_tag_usage Global usage stats for a tag
usp_sec_get_tag_history Time series of one tag for one company

Peer analysis

SP What it returns
usp_sec_list_peers Other CIKs in the same SIC code
usp_sec_peer_analysis One tag across all peers for a given fiscal period

Segments & text

SP What it returns
usp_sec_get_segment_values Dimensional (dimn > 0) numeric rows for a filing
usp_sec_get_text_facts Narrative txt rows for a filing (needs IX_txt_sub)

Validation

SP What it returns
usp_sec_validate_statement_integrity BS / CF / IS sanity check over a CIK slice

Important notes

dim table is stripped. sec_fsnds.dim holds only dimID — the axis/member text (e.g. us-gaap:StatementBusinessSegmentsAxis / msft:ProductivityAndBusinessProcessesMember) is not stored. usp_sec_get_segment_values will tell you which rows are segmented and their dimID, but cannot decode what each dimID actually means. To add that, load the original SEC dim.tsv into a separate dim_text table keyed by dimID.

Collation is case-sensitive. Assets and assets are different tag names. Parameters passed to SPs respect case.

txt is huge. 48M rows / ~100 GB with only PK(txtID). Without IX_txt_sub from the recommended-indexes script, usp_sec_get_text_facts will do a full table scan on every call.


License / attribution

The underlying data is public-domain SEC submissions. The SEC publishes the quarterly FSNDS dumps at https://www.sec.gov/dera/data/financial-statement-and-notes-data-set.

The schema design, stored procedures, Dockerfile, installer, and this README are provided as-is, no warranty. Use at your own risk.

Follow SEC fair-access guidelines when redistributing or querying this data in volume.

Downloads last month
44