外部数据获取流程
原能力
实现推送、轮询、搜索、分页与时点读取,保存原始字节、覆盖和缺口。(合同附件 R7 21.3)
首选项目
OpenBB(Apache-2.0(Open Data Platform,上游 README 与合同记录;供应商另约))。 OpenBB
匹配范围
数据连接器、增量采集与 SEC 披露读取。
源码
OpenBB · class Fetcher(
openbb_platform/core/openbb_core/provider/abstract/fetcher.py · 35–48 行。 在 GitHub 查看源码 · 许可证与声明
源码片段
class Fetcher(Generic[Q, R]):
"""Abstract class for the fetcher."""
# Tell query executor if credentials are required. Can be overridden by subclasses.
require_credentials = True
@staticmethod
def transform_query(params: dict[str, Any]) -> Q:
"""Transform the params to the provider-specific query."""
raise NotImplementedError
@staticmethod
async def aextract_data(query: Q, credentials: dict[str, str] | None) -> Any:
"""Asynchronously extract the data from the provider."""
dlt · class Incremental(
dlt/extract/incremental/__init__.py · 99–112 行。 在 GitHub 查看源码 · 许可证与声明
源码片段
class Incremental(
ItemTransform[TDataItem, IncrementalCustomMetrics], BaseConfiguration, Generic[TCursorValue]
):
"""Adds incremental extraction for a resource by storing a cursor value in persistent state.
The cursor could for example be a timestamp for when the record was created and you can use this to load only
new records created since the last run of the pipeline.
To use this the resource function should have an argument either type annotated with `Incremental` or a default `Incremental` instance.
For example:
>>> @dlt.resource(primary_key='id')
>>> def some_data(created_at=dlt.sources.incremental('created_at', '2023-01-01T00:00:00Z'):
>>> yield from request_data(created_after=created_at.last_value)
实现与验收要点
实际市场、许可、频率、可得时间和独立复核。