<jupyter_start><jupyter_text>Snapshot ExtractionThis notebook shows how to run a Snapshot Explain operation with the minimal steps and a simple query.In this notebook...* [Dependencies and Initialisation](dependencies-and-initialisation)* [The Where Statement](the-where-statement)* [Extraction Query Options](extraction-query-options)* [Running the Extraction Operation](running-the-extraction-operation-decremental)* [Next Steps](Next-Steps)  Dependencies and InitialisationImport statements and environment initialisation using the package `dotenv`. More details in the [Configuration notebook](0.2_configuration.ipynb).<jupyter_code>from factiva.news import Snapshot
from dotenv import load_dotenv
load_dotenv()
print('Done!')<jupyter_output>Done!<jupyter_text>The Where StatementThis notebook uses a simple query for illustration purposes. For more tips about queries, or guidance on how to build complex or large queries, checkout the [query reference](2.1_complex_large_queries.ipynb) notebook.<jupyter_code># Industry i3432 is for Batteries
where_statement = (
    r" publication_datetime >= '2016-01-01 00:00:00' "
    r" AND LOWER(language_code) IN ('en', 'de', 'fr') "
    r" AND REGEXP_CONTAINS(industry_codes, r'(?i)(^|,)(i3432)($|,)') "
)

s = Snapshot(query=where_statement)<jupyter_output><empty_output><jupyter_text>Extraction Query OptionsAn extraction query can use more parameters:* **`file_format`**: _Optional_, _Default: `'avro'`_. File format to be used for Extractions. Possible values are `'avro'`, `'csv'` or `'json'`. Used only by the Extraction operation.* **`limit`**: _Optional_, _Default: `0` (No limit)_. Positive integer that limits the amount of documents to extract. Used only by the Extraction operation.<jupyter_code>s.query.file_format = 'avro'
# s.query.limit = 1000     # Uncomment this line to set a max number of extracted documents<jupyter_output><empty_output><jupyter_text>Running the Extraction Operation   `**(decremental)**`This operation builds a collection of files containing the articles selected according to query conditions.**This operation will decrement 1 extraction from your allowance, and can take several minutes to complete**An Extraction job decrements the account's allowance, and therefore, it's highly recommended to be executed after verifying the same query using [Explain](1.4_snapshot_explain.ipynb) and/or [Analytics](1.5_snapshot_analytics.ipynb) jobs return values in line with the expected volumes.The `.process_extraction()` function directly submits, monitors the job and download the content. If a more manual process is required (send job, monitor job, get results), please see the [detailed package documentation](https://factiva-news-python.readthedocs.io/).To review the **Snapshot History**, please see the notebook [User Statistics](1.1_user_statistics.ipynb).<jupyter_code>%%time
s.process_extraction(download_path='./data/')
print('Done!')<jupyter_output>Done!
CPU times: user 4.72 s, sys: 1.9 s, total: 6.61 s
Wall time: 7min 19s
StarcoderdataJupyterStructuredCleanDedup