Export Destinations

This guide explains when to use each export destination family and how to install only the optional dependencies you need.

For sink internals and data-flow architecture, see Architecture Overview. For full CLI syntax, see Command Line Interface (CLI).

Installation

# Install all tabular export dependencies
pip install "imednet[export]"

# Or install destination-specific extras
pip install "imednet[duckdb]"
pip install "imednet[mongodb]"
pip install "imednet[neo4j]"
pip install "imednet[snowflake]"

Destination decision matrix

Destination

Best fit

Data-shape characteristics

Operational constraints

MongoDB

Application-facing document reads, schema-preserving archival

Keeps nested record_data as document fields and stores record metadata envelope fields (study/form/visit/subject)

Requires pymongo and a MongoDB URI. Graph traversal and relationship analytics are weaker than a native graph store. See MongoDbExportSink and export_to_mongodb().

Neo4j

Relationship-heavy exploration and lineage queries

Preserves the hierarchy Study Subject Visit Record as nodes and relationships, with record_data attached to Record nodes

Requires neo4j driver and Bolt/Neo4j endpoint credentials. Idempotent mode uses MERGE for safe re-runs. See Neo4jExportSink and export_to_neo4j().

Snowflake

Warehouse-native analytics and bulk loading at scale

Writes Parquet batch files, uploads to an internal stage, then issues COPY INTO for table loading

Requires snowflake-connector-python + pyarrow and stage privileges for PUT / COPY INTO. See SnowflakeExportSink and export_to_snowflake().

SDK examples

MongoDB (document export):

from imednet import ImednetSDK
from imednet_sinks import MongoDbSinkConfig, export_to_mongodb

sdk = ImednetSDK(api_key="mock", security_key="mock")
mongodb_cfg = MongoDbSinkConfig(
    study_key="MY_STUDY",
    uri="mongodb://localhost:27017",
    database="imednet",
    collection="records",
    batch_size=500,
    idempotent=True,
)
rows = export_to_mongodb(sdk, "MY_STUDY", config=mongodb_cfg)
print(rows)

Neo4j (graph export):

from imednet import ImednetSDK
from imednet_sinks import Neo4jSinkConfig, export_to_neo4j

sdk = ImednetSDK(api_key="mock", security_key="mock")
neo4j_cfg = Neo4jSinkConfig(
    study_key="MY_STUDY",
    uri="bolt://localhost:7687",
    auth=("neo4j", "..."),
    database="neo4j",
    batch_size=500,
    idempotent=True,
)
rows = export_to_neo4j(sdk, "MY_STUDY", config=neo4j_cfg)
print(rows)

Snowflake (warehouse-native export):

from imednet import ImednetSDK
from imednet_sinks import SnowflakeSinkConfig, export_to_snowflake

sdk = ImednetSDK(api_key="mock", security_key="mock")
snowflake_cfg = SnowflakeSinkConfig(
    study_key="MY_STUDY",
    account="myorg-myaccount",
    user="loader",
    password="...",
    database="IMEDNET_DB",
    schema="PUBLIC",
    warehouse="COMPUTE_WH",
    stage="MY_STAGE",
    table="RECORDS",
)
rows = export_to_snowflake(sdk, "MY_STUDY", config=snowflake_cfg)
print(rows)

Runnable examples