FXMacroData for BigQuery
Load FXMacroData public responses into a customer-owned BigQuery dataset with native JSON load jobs. Preserve records and response metadata alongside typed columns for research and analytical joins.
Install and connect
Requires Python 3.10 or later. Install this package and its adjacent public client dependencies from the distribution supplied to you:
python -m pip install /path/to/fxmacrodata-public-client /path/to/fxmacrodata-platform-core /path/to/bigquery-fxmacrodata
Configure Google Application Default Credentials in your execution environment
and expose the FXMacroData source key as FXMD_API_KEY through your secret store.
The adapter does not read or package a Google credential file.
import os
from google.cloud import bigquery
from fxmacrodata_platform_core import read
from fxmacrodata_bigquery import load
client = bigquery.Client(project=os.environ["GOOGLE_CLOUD_PROJECT"])
try:
batch = read("release_calendar", {"currency": "usd"}, api_key_env="FXMD_API_KEY")
result = load(
batch, client,
f"{client.project}.analytics.fxmacrodata",
location=os.environ["BIGQUERY_LOCATION"],
)
finally:
client.close()
The dataset must exist and its location must match the supplied job location.
The caller needs permission to create jobs and load rows, plus table-creation
permission when create_table=True. Set create_table=False for an existing
table with the schema returned by schema(). Table identifiers must be fully
qualified project.dataset.table names; SQL fragments are rejected.
Every operation exposed by fxmacrodata_platform_core.operations() is available,
including REST and MCP operations. The loader adds a tabular envelope without
changing the original public response. record_json retains the original record;
response_json retains the complete response, including pagination and metadata.
An empty response produces one envelope with record_json = 'null', so absence of
data and the server's metadata remain inspectable. It is not an observation.
Columns are operation, source_url, record_id, currency, indicator,
date, announcement_datetime, value, value_text, record_json,
response_json, and the loader's content_hash. Only value is numeric.
Dates and announcement times remain source strings. No publication time is
inferred, and no missing value is filled. value_text and JSON preserve source
numbers supplied as strings. JSON numeric tokens follow the public Python client
parser, so original lexical precision is not guaranteed.
Select operations with the shared catalogue rather than constructing URLs:
from fxmacrodata_platform_core import operations, schemas
available = operations()
input_schemas = schemas()
load_operation accepts api_key_env, complete_history, max_pages, and
client_factory for the public source reader. max_pages bounds history
pagination; an incomplete read raises an error before a destination load starts.
batch_size bounds destination blocks to 1���10,000 rows. max_batch_bytes also
bounds each block using a conservative JSON byte estimate (16 MiB by default,
128 MiB maximum). An oversized individual envelope is rejected before destination
changes; narrow the source date range to reduce the response size. The source response is
materialized before loading; choose a source date range suitable for memory.
Read the installed operation's schema for required arguments and date filters.
Supply source credentials through your runtime secret store, exposing only the environment variable name to the adapter. Destination authentication belongs to the official SDK connection you pass to the loader. The adapter neither saves nor prints credentials and never constructs destination credentials for you.
The package licence covers this adapter code. FXMacroData data access and onward redistribution remain subject to your subscription and applicable licence. Loading data into a warehouse does not grant permission to publish or resell it.
Retries and querying
Each bounded load job has a deterministic ID derived from the destination and
the complete block. Retrying the same batch with the same block size recovers a
conflicting job by ID and waits for its result. A failed or timed-out job raises
LoadError with its ID; inspect that job before retrying. Earlier jobs may already
have completed. A permanently failed job needs a reviewed correction to the data
or destination; the adapter does not silently submit it under a new ID.
BigQuery retains job metadata for a limited period. IDs therefore do not provide permanent deduplication. Use the supplied view helper for exact repeated envelopes:
from fxmacrodata_bigquery import deduplicated_view_sql
sql = deduplicated_view_sql(
f"{client.project}.analytics.fxmacrodata",
f"{client.project}.analytics.fxmacrodata_distinct",
)
client.query(sql).result()
Content hashes retain changed records and response metadata. This view does not
choose a latest revision or assert that an observation was known at any historic
time. LoadResult.rows counts envelopes submitted, rather than newly created
logical rows. Load jobs append; the loader never truncates a destination table.
event_study.sql joins source announcement times to your licensed market prices. Validate publisher/publication metadata separately for point-in-time research. sharing.md describes the customer-controlled BigQuery Sharing route and its permission and licensing gates.
Test
python -m pytest tests -q
Official SDK reference: BigQuery Python Client.
Metadata
Release files for bigquery-fxmacrodata 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bigquery_fxmacrodata-0.1.0.tar.gz | 10.8 kB | Without provenance | Details for bigquery_fxmacrodata-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bigquery_fxmacrodata-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for bigquery_fxmacrodata-0.1.0-py3-none-any.whl |
Total release size: 18.5 kB
Release files / bigquery_fxmacrodata-0.1.0.tar.gz
| Download URL | bigquery_fxmacrodata-0.1.0.tar.gz |
|---|---|
| Size | 10.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
00db052782e64171aad909da845cbb9aaf9bbab9f525bfd75defce7b6bb73e1a
|
|
BLAKE2b-256 checksum How to use checksums |
805563eca1ce8cf05779f032a088aca8e68bfa92a25cd099308c715b304757ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
FXMacroData-PackagePublisher/1.0
|
Release files / bigquery_fxmacrodata-0.1.0-py3-none-any.whl
| Download URL | bigquery_fxmacrodata-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
db6427ecbd4ac6b62c25f3ef31c37c8e866fdd0b2421742302b3869cdff0ccb3
|
|
BLAKE2b-256 checksum How to use checksums |
4fa65494cb3e81c91fbf88afa3112745b8eb2cc979a2fae769602fec7f109673
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
FXMacroData-PackagePublisher/1.0
|
Security for bigquery-fxmacrodata 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.