API Reference
ApiServer#
API server implementation.
| API | Usage |
|---|---|
| Public | from frictionless.plugins.server import ApiParser |
BigqueryDialect#
Bigquery dialect representation
| API | Usage |
|---|---|
| Public | from frictionless.plugins.bigquery import BigqueryDialect |
Arguments:
descriptor?str|dict - descriptorprojectstr - projectdataset?str - datasettable?str - table
Raises:
FrictionlessException- raise any error that occurs during the process
BigqueryParser#
Bigquery parser implementation.
| API | Usage |
|---|---|
| Public | from frictionless.plugins.bigquery import BigqueryParser |
BigqueryPlugin#
Plugin for BigQuery
| API | Usage |
|---|---|
| Public | from frictionless.plugins.bigquery import BigqueryPlugin |
BigqueryStorage#
BigQuery storage implementation
| API | Usage |
|---|---|
| Public | from frictionless.plugins.bigquery import BigqueryStorage |
Arguments:
serviceobject - BigQueryServiceobjectprojectstr - BigQuery project namedatasetstr - BigQuery dataset nameprefix?str - prefix for all names
BufferControl#
Buffer control representation
| API | Usage |
|---|---|
| Public | from frictionless.plugins.buffer import BufferControl |
Arguments:
descriptor?str|dict - descriptor
Raises:
FrictionlessException- raise any error that occurs during the process
BufferLoader#
Buffer loader implementation.
| API | Usage |
|---|---|
| Public | from frictionless.plugins.buffer import BufferLoader |
BufferPlugin#
Plugin for Buffer Data
| API | Usage |
|---|---|
| Public | from frictionless.plugins.local import BufferPlugin |
Check#
Check representation.
| API | Usage |
|---|---|
| Public | from frictionless import Checks |
It's an interface for writing Frictionless checks.
Arguments:
descriptor?str|dict - schema descriptor
Raises:
FrictionlessException- raise if metadata is invalid
check.resource#
Returns:
Resource?- resource object available after thecheck.connectcall
check.connect#
Connect to the given resource
Arguments:
resourceResource - data resource
check.validate_start#
Called to validate the resource after opening
Yields:
Error- found errors
check.validate_row#
Called to validate the given row (on every row)
Arguments:
rowRow - table row
Yields:
Error- found errors
check.validate_end#
Called to validate the resource before closing
Yields:
Error- found errors
CkanDialect#
Ckan dialect representation
| API | Usage |
|---|---|
| Public | from frictionless.plugins.ckan import CkanDialect |
Arguments:
descriptor?str|dict - descriptorresource?str - resourcedataset?str - datasetapikey?str - apikeyfields?array - limit ckan query to certain fieldslimit?int - limit number of returned entriessort?str - sort returned entries, e.g. by date descending:date descfilters?dict - filter data, e.g. field with value:{ "key": "value" }
Raises:
FrictionlessException- raise any error that occurs during the process
CkanParser#
Ckan parser implementation.
| API | Usage |
|---|---|
| Public | from frictionless.plugins.ckan import CkanParser |
CkanPlugin#
Plugin for CKAN
| API | Usage |
|---|---|
| Public | from frictionless.plugins.ckan import CkanPlugin |
CkanStorage#
Ckan storage implementation
Arguments:
urlstring - CKAN instance url e.g. "https://demo.ckan.org"datasetstring - dataset id in CKAN e.g. "my-dataset"apikey?str - API key for CKAN e.g. "51912f57-a657-4caa-b2a7-0a1c16821f4b"API Usage Public from frictionless.plugins.ckan import CkanStorage
Control#
Control representation
| API | Usage |
|---|---|
| Public | from frictionless import Control |
Arguments:
descriptor?str|dict - descriptor
Raises:
FrictionlessException- raise any error that occurs during the process
CsvDialect#
Csv dialect representation
| API | Usage |
|---|---|
| Public | from frictionless.plugins.csv import CsvDialect |
Arguments:
descriptor?str|dict - descriptordelimiter?str - csv delimiterline_terminator?str - csv line terminatorquote_char?str - csv quote chardouble_quote?bool - csv double quoteescape_char?str - csv escape charnull_sequence?str - csv null sequenceskip_initial_space?bool - csv skip initial spacecomment_char?str - csv comment char
Raises:
FrictionlessException- raise any error that occurs during the process
csvDialect.delimiter#
Returns:
str- delimiter
csvDialect.line_terminator#
Returns:
str- line terminator
csvDialect.quote_char#
Returns:
str- quote char
csvDialect.double_quote#
Returns:
bool- double quote
csvDialect.escape_char#
Returns:
str?- escape char
csvDialect.null_sequence#
Returns:
str?- null sequence
csvDialect.skip_initial_space#
Returns:
bool- if skipping initial space
csvDialect.comment_char#
Returns:
str?- comment char
csvDialect.expand#
Expand metadata
csvDialect.to_python#
Conver to Python's csv.Dialect
CsvParser#
CSV parser implementation.
| API | Usage |
|---|---|
| Public | `from frictionless.plugins.csv import CsvPlugins |
CsvPlugin#
Plugin for Pandas
| API | Usage |
|---|---|
| Public | from frictionless.plugins.csv import CsvPlugin |
Detector#
Detector representation
| API | Usage |
|---|---|
| Public | from frictionless import Detector |
Arguments:
buffer_size?int - The amount of bytes to be extracted as a buffer. It defaults to 10000sample_size?int - The amount of rows to be extracted as a sample. It defaults to 100encoding_function?func - A custom encoding function for the file.encoding_confidence?float - Confidence value for encoding function.field_type?str - Enforce all the inferred types to be this type. For more information, please check "Describing Data" guide.field_names?str[] - Enforce all the inferred fields to have provided names. For more information, please check "Describing Data" guide.field_confidence?float - A number from 0 to 1 setting the infer confidence. If 1 the data is guaranteed to be valid against the inferred schema. For more information, please check "Describing Data" guide. It defaults to 0.9field_float_numbers?bool - Flag to indicate desired number type. By default numbers will beDecimal; ifTrue-float. For more information, please check "Describing Data" guide. It defaults toFalsefield_missing_values?str[] - String to be considered as missing values. For more information, please check "Describing Data" guide. It defaults to['']schema_sync?bool - Whether to sync the schema. If it sets toTruethe provided schema will be mapped to the inferred schema. It means that, for example, you can provide a subset of fileds to be applied on top of the inferred fields or the provided schema can have different order of fields.schema_patch?dict - A dictionary to be used as an inferred schema patch. The form of this dictionary should follow the Schema descriptor form except for thefieldsproperty which should be a mapping with the key named after a field name and the values being a field patch. For more information, please check "Extracting Data" guide.
detector.buffer_size#
Returns buffer size of the detector. Default value is 10000.
Returns:
int- detector buffer size
detector.buffer_size#
Sets buffer size for detector.
Arguments:
valueint - detector buffer size
detector.sample_size#
Returns sample size of the detector. Default value is 100.
Returns:
int- detector sample size
detector.sample_size#
Sets sample size for detector.
Arguments:
valueint - detector sample size
detector.encoding_function#
Returns detector custom encoding function
Returns:
any- detector custom encoding function
detector.encoding_function#
Sets detector custom encoding function for the resource to be read.
Arguments:
valueany - detector custom encoding function
detector.encoding_confidence#
Returns confidence value for detector encoding function.
Returns:
float- detector encoding function confidence
detector.encoding_confidence#
Sets confidence value for detector encoding function. Default value is None.
Arguments:
valuefloat - detector encoding function confidence
detector.field_type#
Returns field type of the detector. Default value is None.
Returns:
str- detector inferred field types
detector.field_type#
Sets field type for all inferred fields by the detector.
Arguments:
valuestr - detector inferred field types
detector.field_names#
Returns inferred field names list.
Returns:
str[]- detector inferred field names
detector.field_names#
Sets field names for all inferred fields by the detector.
Arguments:
valuestr[] - detector inferred field names
detector.field_confidence#
Returns detector inference confidence value. Default value is 0.9.
Returns:
float- detector inference confidence value
detector.field_confidence#
Sets inference confidence value for detector. Default value is 0.9.
Arguments:
valuefloat - detector inference confidence value
detector.field_float_numbers#
Returns detector convert decimal to float flag value.
Returns:
bool- detector convert decimal to float flag
detector.field_float_numbers#
Sets detector convert decimal to float flag.
Arguments:
valuebool - detector convert decimal to float flag
detector.field_missing_values#
Returns detector fields missing values list.
Returns:
str[]- detector fields missing values list
detector.field_missing_values#
Sets detector fields missing values list.
Arguments:
valuestr[] - detector fields missing values list
detector.schema_sync#
Returns detector schema_sync flag value.
Returns:
bool- detector schema_sync flag value
detector.schema_sync#
Sets detector schema_sync flag value. If set to true, it syncs provided schema's field order based on the header's field order.
Arguments:
valuebool - detector schema_sync flag value
detector.schema_patch#
Returns detector resource fields to change.
Returns:
Dict- detector resource fields to change
detector.schema_patch#
Sets detector resource fields to change.
Arguments:
valueDict - detector resource fields to change
detector.detect_encoding#
Detect encoding from buffer
Arguments:
bufferbyte - byte buffer
Returns:
str- encoding
detector.detect_layout#
Detect layout from sample
Arguments:
sampleany[][] - data samplelayout?Layout - data layout
Returns:
Layout- layout
detector.detect_schema#
Detect schema from fragment
Arguments:
fragmentany[][] - data fragmentlabels?str[] - data labelsschema?Schema - data schema
Returns:
Schema- schema
Dialect#
Dialect representation
| API | Usage |
|---|---|
| Public | from frictionless import Dialect |
Arguments:
descriptor?str|dict - descriptor
Raises:
FrictionlessException- raise any error that occurs during the process
Error#
Error representation
| API | Usage |
|---|---|
| Public | from frictionless import errors |
Arguments:
descriptor?str|dict - error descriptornotestr - an error note
Raises:
FrictionlessException- raise any error that occurs during the process
error.note#
Returns:
str- note
error.message#
Returns:
str- message
ExcelDialect#
Excel dialect representation
| API | Usage |
|---|---|
| Public | from frictionless.plugins.excel import ExcelDialect |
Arguments:
descriptor?str|dict - descriptorsheet?int|str - number from 1 or name of an excel sheetworkbook_cache?dict - workbook cachefill_merged_cells?bool - whether to fill merged cellspreserve_formatting?bool - whither to preserve formattingadjust_floating_point_error?bool - whether to adjust floating point error
Raises:
FrictionlessException- raise any error that occurs during the process
excelDialect.sheet#
Returns:
str|int- sheet
excelDialect.workbook_cache#
Returns:
dict- workbook cache
excelDialect.fill_merged_cells#
Returns:
bool- fill merged cells
excelDialect.preserve_formatting#
Returns:
bool- preserve formatting
excelDialect.adjust_floating_point_error#
Returns:
bool- adjust floating point error
excelDialect.expand#
Expand metadata
ExcelPlugin#
Plugin for Excel
| API | Usage |
|---|---|
| Public | from frictionless.plugins.excel import ExcelPlugin |
Field#
Field representation
| API | Usage |
|---|---|
| Public | from frictionless import Field |
Arguments:
descriptor?str|dict - field descriptorname?str - field name (for machines)title?str - field title (for humans)description?str - field descriptiontype?str - field type e.g.stringformat?str - field format e.g.defaultmissing_values?str[] - missing valuesconstraints?dict - constraintsrdf_type?str - RDF typeschema?Schema - parent schema object
Raises:
FrictionlessException- raise any error that occurs during the process
field.name#
Returns:
str- name
field.title#
Returns:
str- title
field.description#
Returns:
str- description
field.description_html#
Returns:
str- field description
field.description_text#
Returns:
str- field description
field.type#
Returns:
str- type
field.format#
Returns:
str- format
field.missing_values#
Returns:
str[]- missing values
field.constraints#
Returns:
dict- constraints
field.rdf_type#
Returns:
str- RDF Type
field.required#
Returns:
bool- if field is requried
field.builtin#
Returns:
bool- returns True is the type is not custom
field.schema#
Returns:
Schema?- parent schema
field.array_item#
Returns:
dict- field descriptor
field.array_item_field#
Returns:
dict- field descriptor
field.true_values#
Returns:
str[]- true values
field.false_values#
Returns:
str[]- false values
field.bare_number#
Returns:
bool- if a bare number
field.float_number#
Returns:
bool- whether it's a floating point number
field.decimal_char#
Returns:
str- decimal char
field.group_char#
Returns:
str- group char
field.example#
Returns:
any- example value
field.expand#
Expand metadata
field.read_cell#
Read cell
Arguments:
cellany - cell
Returns:
(any, OrderedDict): processed cell and dict of notes
field.read_cell_convert#
Read cell (convert only)
Arguments:
cellany - cell
Returns:
any/None- processed cell or None if an error
field.read_cell_checks#
Read cell (checks only)
Returns:
OrderedDict- dictionlary of check function by a constraint name
field.write_cell#
Write cell
Arguments:
cellany - cell to convertignore_missing?bool - don't convert None values
Returns:
(any, OrderedDict): processed cell and dict of notes
field.write_cell_convert#
Write cell (convert only)
Arguments:
cellany - cell
Returns:
any/None- processed cell or None if an error
field.write_cell_missing_value#
Write cell (missing value only)
Returns:
str- a value to replace None cells
File#
File representation
FrictionlessException#
Main Frictionless exception
| API | Usage |
|---|---|
| Public | from frictionless import FrictionlessException |
Arguments:
errorError - an underlaying error
frictionlessException.error#
Returns:
Error- error
GsheetsDialect#
Gsheets dialect representation
| API | Usage |
|---|---|
| Public | from frictionless.plugins.gsheets import GsheetsDialect |
Arguments:
descriptor?str|dict - descriptor
Raises:
FrictionlessException- raise any error that occurs during the process
gsheetsDialect.credentials#
Returns:
str- credentials
GsheetsParser#
Google Sheets parser implementation.
| API | Usage |
|---|---|
| Public | from frictionless.plugins.gsheets import GsheetsParser |
GsheetsPlugin#
Plugin for Google Sheets
| API | Usage |
|---|---|
| Public | from frictionless.plugins.gsheets import GsheetsPlugin |
Header#
Header representation
| API | Usage |
|---|---|
| Public | from frictionless import Header |
Constructor of this object is not Public API
Arguments:
labelsany[] - header row labelsfieldsField[] - table fieldsfield_positionsint[] - field positionsrow_positionsint[] - row positionsignore_casebool - ignore case
header.labels#
Returns:
Schema- table labels
header.fields#
Returns:
Schema- table fields
header.field_names#
Returns:
str[]- table field names
header.field_positions#
Returns:
int[]- table field positions
header.row_positions#
Returns:
int[]- table row positions
header.missing#
Returns:
bool- if there is not header
header.errors#
Returns:
Error[]- header errors
header.valid#
Returns:
bool- if header valid
header.to_str#
Returns:
str- a row as a CSV string
header.to_list#
Convert to a list
HtmlDialect#
Html dialect representation
| API | Usage |
|---|---|
| Public | from frictionless.plugins.html import HtmlDialect |
Arguments:
descriptor?str|dict - descriptorselector?str - HTML selector
Raises:
FrictionlessException- raise any error that occurs during the process
htmlDialect.selector#
Returns:
str- selector
htmlDialect.expand#
Expand metadata
HtmlParser#
HTML parser implementation.
| API | Usage |
|---|---|
| Public | from frictionless.plugins.html import HtmlParser |
HtmlPlugin#
Plugin for HTML
| API | Usage |
|---|---|
| Public | from frictionless.plugins.html import HtmlPlugin |
InlineDialect#
Inline dialect representation
| API | Usage |
|---|---|
| Public | from frictionless.plugins.inline import InlineDialect |
Arguments:
descriptor?str|dict - descriptorkeys?str[] - a list of strings to use as data keyskeyed?bool - whether data rows are keyed
Raises:
FrictionlessException- raise any error that occurs during the process
inlineDialect.data_keys#
Returns:
str[]?- keys
inlineDialect.keyed#
Returns:
bool- keyed
inlineDialect.expand#
Expand metadata
InlineParser#
Inline parser implementation.
| API | Usage |
|---|---|
| Public | `from frictionless.plugins.inline import InlineParser |
InlinePlugin#
Plugin for Inline
| API | Usage |
|---|---|
| Public | from frictionless.plugins.inline import InlinePlugin |
Inquiry#
Inquiry representation.
Arguments:
descriptor?str|dict - descriptor
Raises:
FrictionlessException- raise any error that occurs during the process
inquiry.tasks#
Returns:
dict[]- tasks
InquiryTask#
Inquiry task representation.
Arguments:
descriptor?str|dict - descriptor
Raises:
FrictionlessException- raise any error that occurs during the process
inquiryTask.source#
Returns:
any- source
inquiryTask.type#
Returns:
string?- type
JsonDialect#
Json dialect representation
| API | Usage |
|---|---|
| Public | from frictionless.plugins.json import JsonDialect |
Arguments:
descriptor?str|dict - descriptorkeys?str[] - a list of strings to use as data keyskeyed?bool - whether data rows are keyedproperty?str - a path within JSON to the data
Raises:
FrictionlessException- raise any error that occurs during the process
jsonDialect.keys#
Returns:
str[]?- keys
jsonDialect.keyed#
Returns:
bool- keyed
jsonDialect.property#
Returns:
str?- property
jsonDialect.expand#
Expand metadata
JsonParser#
JSON parser implementation.
| API | Usage |
|---|---|
| Public | `from frictionless.plugins.json import JsonParser |
JsonPlugin#
Plugin for Json
| API | Usage |
|---|---|
| Public | from frictionless.plugins.json import JsonPlugin |
JsonlParser#
JSONL parser implementation.
| API | Usage |
|---|---|
| Public | `from frictionless.plugins.json import JsonlParser |
Layout#
Layout representation
| API | Usage |
|---|---|
| Public | from frictionless import Layout |
Arguments:
descriptor?str|dict - layout descriptorheader_rows?int[] - row numbers to form header (list all of them not only from/to)header_join?str - a string to be used as a joiner for multiline headerheader_case?bool - whether to respect header case (default: True) pick_fields? ((str|int)[]): what fields to pick skip_fields? ((str|int)[]): what fields to skiplimit_fields?int - amount of fieldsoffset_fields?int - from what field to start pick_rows? ((str|int)[]): what rows to pick skip_rows? ((str|int)[]): what rows to skiplimit_rows?int - amount of rowsoffset_rows?int - from what row to start
layout.header#
Returns:
bool- if there is a header row
layout.header_rows#
Returns:
int[]- header rows
layout.header_join#
Returns:
str- header joiner
layout.header_case#
Returns:
str- header case sensitive
layout.pick_fields#
Returns:
(str|int)[]?- pick fields
layout.skip_fields#
Returns:
(str|int)[]?- skip fields
layout.limit_fields#
Returns:
int?- limit fields
layout.offset_fields#
Returns:
int?- offset fields
layout.pick_rows#
Returns:
(str|int)[]?- pick rows
layout.skip_rows#
Returns:
(str|int)[]?- skip rows
layout.limit_rows#
Returns:
int?- limit rows
layout.offset_rows#
Returns:
int?- offset rows
layout.is_field_filtering#
Returns:
bool- whether there is a field filtering
layout.pick_fields_compiled#
Returns:
re?- compiled pick fields
layout.skip_fields_compiled#
Returns:
re?- compiled skip fields
layout.pick_rows_compiled#
Returns:
re?- compiled pick rows
layout.skip_rows_compiled#
Returns:
re?- compiled skip fields
layout.expand#
Expand metadata
Loader#
Loader representation
| API | Usage |
|---|---|
| Public | from frictionless import Loader |
Arguments:
resourceResource - resource
loader.resource#
Returns:
resourceResource - resource
loader.buffer#
Returns:
Loader- buffer
loader.byte_stream#
Resource byte stream
The stream is available after opening the loader
Returns:
io.ByteStream- resource byte stream
loader.text_stream#
Resource text stream
The stream is available after opening the loader
Returns:
io.TextStream- resource text stream
loader.open#
Open the loader as "io.open" does
loader.close#
Close the loader as "filelike.close" does
loader.closed#
Whether the loader is closed
Returns:
bool- if closed
loader.read_byte_stream#
Read bytes stream
Returns:
io.ByteStream- resource byte stream
loader.read_byte_stream_create#
Create bytes stream
Returns:
io.ByteStream- resource byte stream
loader.read_byte_stream_process#
Process byte stream
Arguments:
byte_streamio.ByteStream - resource byte stream
Returns:
io.ByteStream- resource byte stream
loader.read_byte_stream_decompress#
Decompress byte stream
Arguments:
byte_streamio.ByteStream - resource byte stream
Returns:
io.ByteStream- resource byte stream
loader.read_byte_stream_buffer#
Buffer byte stream
Arguments:
byte_streamio.ByteStream - resource byte stream
Returns:
bytes- buffer
loader.read_byte_stream_analyze#
Detect metadta using sample
Arguments:
bufferbytes - byte buffer
loader.read_text_stream#
Read text stream
Returns:
io.TextStream- resource text stream
loader.write_byte_stream#
Write from a temporary file
Arguments:
pathstr - path to a temporary file
Returns:
any- result of writing e.g. resulting path
loader.write_byte_stream_create#
Create byte stream for writing
Arguments:
pathstr - path to a temporary file
Returns:
io.ByteStream- byte stream
loader.write_byte_stream_save#
Store byte stream
LocalControl#
Local control representation
| API | Usage |
|---|---|
| Public | from frictionless.plugins.local import LocalControl |
Arguments:
descriptor?str|dict - descriptor
Raises:
FrictionlessException- raise any error that occurs during the process
LocalLoader#
Local loader implementation.
| API | Usage |
|---|---|
| Public | from frictionless.plugins.local import LocalLoader |
LocalPlugin#
Plugin for Local Data
| API | Usage |
|---|---|
| Public | from frictionless.plugins.local import LocalPlugin |
Metadata#
Metadata representation
| API | Usage |
|---|---|
| Public | from frictionless import Metadata |
Arguments:
descriptor?str|dict - metadata descriptor
Raises:
FrictionlessException- raise any error that occurs during the process
metadata.setinitial#
Set an initial item in a subclass' constructor
Arguments:
keystr - keyvalueany - value
metadata.__repr__#
Returns string representation for metadata.
metadata.to_copy#
Create a copy of the metadata
Returns:
Metadata- a copy of the metadata
metadata.to_dict#
Convert metadata to a plain dict
Returns:
dict- metadata as a plain dict
metadata.to_json#
Save metadata as a json
Arguments:
pathstr - target path
Raises:
FrictionlessException- on any error
metadata.to_yaml#
Save metadata as a yaml
Arguments:
pathstr - target path
Raises:
FrictionlessException- on any error
metadata.to_markdown#
Convert metadata as a markdown
This feature has been contributed to the framwork by Ethan Welty (@ezwelty):
Arguments:
pathstr - target pathtablebool - if true converts markdown to tabular format
Raises:
FrictionlessException- on any error
metadata.metadata_valid#
Returns:
bool- whether the metadata is valid
metadata.metadata_errors#
Returns:
Errors[]- a list of the metadata errors
metadata.metadata_attach#
Helper method for attaching a value to the metadata
Arguments:
namestr - namevalueany - value
metadata.metadata_extract#
Helper method called during the metadata extraction
Arguments:
descriptorany - descriptor
metadata.metadata_process#
Helper method called on any metadata change
metadata.metadata_validate#
Helper method called on any metadata change
Arguments:
profiledict - a profile to validate against of
metadata.property#
Create a metadata property
Arguments:
funcfunc - methodcache?bool - cachereset?bool - resetwrite?func - write
MultipartControl#
Multipart control representation
| API | Usage |
|---|---|
| Public | from frictionless.plugins.multipart import MultipartControl |
Arguments:
descriptor?str|dict - descriptor
Raises:
FrictionlessException- raise any error that occurs during the process
multipartControl.expand#
Expand metadata
MultipartLoader#
Multipart loader implementation.
| API | Usage |
|---|---|
| Public | from frictionless.plugins.multipart import MultipartLoader |
MultipartPlugin#
Plugin for Multipart Data
| API | Usage |
|---|---|
| Public | from frictionless.plugins.multipart import MultipartPlugin |
OdsDialect#
Ods dialect representation
| API | Usage |
|---|---|
| Public | from frictionless.plugins.ods import OdsDialect |
Arguments:
descriptor?str|dict - descriptorsheet?str - sheet
Raises:
FrictionlessException- raise any error that occurs during the process
odsDialect.sheet#
Returns:
int|str- sheet
odsDialect.expand#
Expand metadata
OdsParser#
ODS parser implementation.
| API | Usage |
|---|---|
| Public | from frictionless.plugins.ods import OdsParser |
OdsPlugin#
Plugin for ODS
| API | Usage |
|---|---|
| Public | from frictionless.plugins.ods import OdsPlugin |
Package#
Package representation
| API | Usage |
|---|---|
| Public | from frictionless import Package |
This class is one of the cornerstones of of Frictionless framework. It manages underlaying resource and provides an ability to describe a package.
Arguments:
sourceany - Source of the package; can be in various forms. Usually, it's a package descriptor in a form of dict or path Also, it can be a glob pattern or a resource pathdescriptordict|str - A resource descriptor provided explicitly. Keyword arguments will patch this descriptor if provided.resources?dict|Resource[] - A list of resource descriptors. It can be dicts or Resource instances.id?str - A property reserved for globally unique identifiers. Examples of identifiers that are unique include UUIDs and DOIs.name?str - A short url-usable (and preferably human-readable) name. This MUST be lower-case and contain only alphanumeric characters along with “.”, “_” or “-” characters.title?str - A Package title according to the specs It should a human-oriented title of the resource.description?str - A Package description according to the specs It should a human-oriented description of the resource.licenses?dict[] - The license(s) under which the package is provided. If omitted it's considered the same as the package's licenses.sources?dict[] - The raw sources for this data package. It MUST be an array of Source objects. Each Source object MUST have a title and MAY have path and/or email properties.profile?str - A string identifying the profile of this descriptor. For example,fiscal-data-package.homepage?str - A URL for the home on the web that is related to this package. For example, github repository or ckan dataset address.version?str - A version string identifying the version of the package. It should conform to the Semantic Versioning requirements and should follow the Data Package Version pattern.contributors?dict[] - The people or organizations who contributed to this package. It MUST be an array. Each entry is a Contributor and MUST be an object. A Contributor MUST have a title property and MAY contain path, email, role and organization properties.keywords?str[] - An Array of string keywords to assist users searching. For example, ['data', 'fiscal']image?str - An image to use for this data package. For example, when showing the package in a listing.created?str - The datetime on which this was created. The datetime must conform to the string formats for RFC3339 datetime,innerpath?str - A ZIP datapackage descriptor inner path. Path to the package descriptor inside the ZIP datapackage.Example- some/folder/datapackage.yamlDefault- datapackage.jsonbasepath?str - A basepath of the resource The fullpath of the resource is joinedbasepathand /path`detector?Detector - File/table detector. For more information, please check the Detector documentation.onerror?ignore|warn|raise - Behaviour if there is an error. It defaults to 'ignore'. The default mode will ignore all errors on resource level and they should be handled by the user being available in Header and Row objects.trusted?bool - Don't raise an exception on unsafe paths. A path provided as a part of the descriptor considered unsafe if there are path traversing or the path is absolute. A path provided assourceorpathis alway trusted.hashing?str - a hashing algorithm for resources It defaults to 'md5'.
Raises:
FrictionlessException- raise any error that occurs during the process
package.name#
Returns:
str- package name
package.id#
Returns:
str- package id
package.licenses#
Returns:
dict[]- package licenses
package.profile#
Returns:
str- package profile
package.title#
Returns:
str- package title
package.description#
Returns:
str- package description
package.description_html#
Returns:
str- package description
package.description_text#
Returns:
str- package description
package.homepage#
Returns:
str- package homepage
package.version#
Returns:
str- package version
package.sources#
Returns:
dict[]- package sources
package.contributors#
Returns:
dict[]- package contributors
package.keywords#
Returns:
str[]- package keywords
package.image#
Returns:
str- package image
package.created#
Returns:
str- package created
package.hashing#
Returns:
str- package hashing
package.basepath#
Returns:
str- package basepath
package.onerror#
Returns:
ignore|warn|raise- on error bahaviour
package.trusted#
Returns:
str- package trusted
package.resources#
Returns:
Resources[]- package resource
package.resource_names#
Returns:
str[]- package resource names
package.add_resource#
Add new resource to the package.
Arguments:
sourcedict|str - a data source**optionsdict - options of the Resource class
Returns:
Resource/None- addedResourceinstance orNoneif not added
package.get_resource#
Get resource by name.
Arguments:
namestr - resource name
Raises:
FrictionlessException- if resource is not found
Returns:
Resource/None-Resourceinstance orNoneif not found
package.has_resource#
Check if a resource is present
Arguments:
namestr - schema resource name
Returns:
bool- whether there is the resource
package.remove_resource#
Remove resource by name.
Arguments:
namestr - resource name
Raises:
FrictionlessException- if resource is not found
Returns:
Resource/None- removedResourceinstances orNoneif not found
package.expand#
Expand metadata
It will add default values to the package.
package.infer#
Infer package's attributes
Arguments:
stats?bool - stream files completely and infer stats
package.to_copy#
Create a copy of the package
package.from_bigquery#
Import package from Bigquery
Arguments:
sourcestring - BigQueryServiceobjectdialectdict - BigQuery dialect
Returns:
Package- package
package.to_bigquery#
Export package to Bigquery
Arguments:
targetstring - BigQueryServiceobjectdialectdict - BigQuery dialect
Returns:
BigqueryStorage- storage
package.from_ckan#
Import package from CKAN
Arguments:
sourcestring - CKAN instance url e.g. "https://demo.ckan.org"dialectdict - CKAN dialect
Returns:
Package- package
package.to_ckan#
Export package to CKAN
Arguments:
targetstring - CKAN instance url e.g. "https://demo.ckan.org"dialectdict - CKAN dialect
Returns:
CkanStorage- storage
package.from_sql#
Import package from SQL
Arguments:
sourceany - SQL connection string of enginedialectdict - SQL dialect
Returns:
Package- package
package.to_sql#
Export package to SQL
Arguments:
targetany - SQL connection string of enginedialectdict - SQL dialect
Returns:
SqlStorage- storage
package.from_zip#
Create a package from ZIP
Arguments:
path(str)- file path**options(dict)- resouce options
package.to_zip#
Save package to a zip
Arguments:
pathstr - target pathencoder_classobject - json encoder class
Raises:
FrictionlessException- on any error
PandasDialect#
Pandas dialect representation
| API | Usage |
|---|---|
| Public | from frictionless.plugins.pandas import PandasDialect |
Arguments:
descriptor?str|dict - descriptor
Raises:
FrictionlessException- raise any error that occurs during the process
PandasParser#
Pandas parser implementation.
| API | Usage |
|---|---|
| Public | from frictionless.plugins.pandas import PandasParser |
PandasPlugin#
Plugin for Pandas
| API | Usage |
|---|---|
| Public | from frictionless.plugins.pandas import PandasPlugin |
Parser#
Parser representation
| API | Usage |
|---|---|
| Public | from frictionless import Parser |
Arguments:
resourceResource - resource
parser.resource#
Returns:
Resource- resource
parser.loader#
Returns:
Loader- loader
parser.sample#
Returns:
Loader- sample
parser.list_stream#
Yields:
any[][]- list stream
parser.open#
Open the parser as "io.open" does
parser.close#
Close the parser as "filelike.close" does
parser.closed#
Whether the parser is closed
Returns:
bool- if closed
parser.read_loader#
Create and open loader
Returns:
Loader- loader
parser.read_list_stream#
Read list stream
Returns:
gen<any[][]>- list stream
parser.read_list_stream_create#
Create list stream from loader
Arguments:
loaderLoader - loader
Returns:
gen<any[][]>- list stream
parser.read_list_stream_handle_errors#
Wrap list stream into error handler
Arguments:
gen<any[][]>- list stream
Returns:
gen<any[][]>- list stream
parser.write_row_stream#
Write row stream from the source resource
Arguments:
sourceResource - source resource
Pipeline#
Pipeline representation.
Arguments:
descriptor?str|dict - pipeline descriptor
Raises:
FrictionlessException- raise any error that occurs during the process
pipeline.tasks#
Returns:
dict[]- tasks
pipeline.run#
Run the pipeline
PipelineTask#
Pipeline task representation.
Arguments:
descriptor?str|dict - pipeline task descriptor
Raises:
FrictionlessException- raise any error that occurs during the process
pipelineTask.run#
Run the task
Plugin#
Plugin representation
| API | Usage |
|---|---|
| Public | from frictionless import Plugin |
It's an interface for writing Frictionless plugins. You can implement one or more methods to hook into Frictionless system.
plugin.create_candidates#
Create candidates
Returns:
dict[]- an ordered by priority list of type descriptors for type detection
plugin.create_check#
Create check
Arguments:
namestr - check namedescriptordict - check descriptor
Returns:
Check- check
plugin.create_control#
Create control
Arguments:
fileFile - control filedescriptordict - control descriptor
Returns:
Control- control
plugin.create_dialect#
Create dialect
Arguments:
fileFile - dialect filedescriptordict - dialect descriptor
Returns:
Dialect- dialect
plugin.create_error#
Create error
Arguments:
descriptordict - error descriptor
Returns:
Error- error
plugin.create_file#
Create file
Arguments:
sourceany - file sourceoptionsdict - file options
Returns:
File- file
plugin.create_loader#
Create loader
Arguments:
fileFile - loader file
Returns:
Loader- loader
plugin.create_parser#
Create parser
Arguments:
fileFile - parser file
Returns:
Parser- parser
plugin.create_server#
Create server
Arguments:
namestr - server name
Returns:
Server- server
plugin.create_step#
Create step
Arguments:
descriptordict - step descriptor
Returns:
Step- step
plugin.create_storage#
Create storage
Arguments:
namestr - storage nameoptionsstr - storage options
Returns:
Storage- storage
plugin.create_type#
Create type
Arguments:
fieldField - corresponding field
Returns:
Type- type
RemoteControl#
Remote control representation
| API | Usage |
|---|---|
| Public | from frictionless.plugins.remote import RemoteControl |
Arguments:
descriptor?str|dict - descriptorhttp_session?requests.Session - user defined HTTP sessionhttp_preload?bool - don't use HTTP streaming and preload all the datahttp_timeout?int - user defined HTTP timeout in minutes
Raises:
FrictionlessException- raise any error that occurs during the process
remoteControl.http_session#
Returns:
requests.Session- HTTP session
remoteControl.http_preload#
Returns:
bool- if not streaming
remoteControl.http_timeout#
Returns:
int- HTTP timeout in minutes
remoteControl.expand#
Expand metadata
RemoteLoader#
Remote loader implementation.
| API | Usage |
|---|---|
| Public | from frictionless.plugins.remote import RemoteLoader |
RemotePlugin#
Plugin for Remote Data
| API | Usage |
|---|---|
| Public | from frictionless.plugins.remote import RemotePlugin |
Report#
Report representation.
| API | Usage |
|---|---|
| Public | from frictionless import Report |
Arguments:
descriptor?str|dict - report descriptortimefloat - validation timeerrorsError[] - validation errorstasksReportTask[] - validation tasks
Raises:
FrictionlessException- raise any error that occurs during the process
report.version#
Returns:
str- frictionless version
report.time#
Returns:
float- validation time
report.valid#
Returns:
bool- validation result
report.stats#
Returns:
dict- validation stats
report.errors#
Returns:
Error[]- validation errors
report.tasks#
Returns:
ReportTask[]- validation tasks
report.task#
Returns:
ReportTask- validation task (if there is only one)
Raises:
FrictionlessException- if there are more that 1 task
report.expand#
Expand metadata
report.flatten#
Flatten the report
Parameters spec (any[]): flatten specification
Returns:
any[]- flatten report
report.from_validate#
Validate function wrapper
Arguments:
validatefunc - validate
Returns:
func- wrapped validate
ReportTask#
Report task representation.
| API | Usage |
|---|---|
| Public | from frictionless import ReportTask |
Arguments:
descriptor?str|dict - schema descriptortimefloat - validation timescopestr[] - validation scopepartialbool - wehter validation was partialerrorsError[] - validation errorstaskTask - validation taskRaises#
FrictionlessException- raise any error that occurs during the process
reportTask.resource#
Returns:
Resource- resource
reportTask.time#
Returns:
float- validation time
reportTask.valid#
Returns:
bool- validation result
reportTask.scope#
Returns:
str[]- validation scope
reportTask.partial#
Returns:
bool- if validation partial
reportTask.stats#
Returns:
dict- validation stats
reportTask.errors#
Returns:
Error[]- validation errors
reportTask.error#
Returns:
Error- validation error if there is only one
Raises:
FrictionlessException- if more than one errors
reportTask.expand#
Expand metadata
reportTask.flatten#
Flatten the report
Parameters spec (any[]): flatten specification
Returns:
any[]- flatten task report
Resource#
Resource representation.
| API | Usage |
|---|---|
| Public | from frictionless import Resource |
This class is one of the cornerstones of of Frictionless framework. It loads a data source, and allows you to stream its parsed contents. At the same time, it's a metadata class data description.
Arguments:
sourceany - Source of the resource; can be in various forms. Usually, it's a string as<scheme>://path/to/file.<format>. It also can be, for example, an array of data arrays/dictionaries. Or it can be a resource descriptor dict or path.descriptordict|str - A resource descriptor provided explicitly. Keyword arguments will patch this descriptor if provided.name?str - A Resource name according to the specs. It should be a slugified name of the resource.title?str - A Resource title according to the specs It should a human-oriented title of the resource.description?str - A Resource description according to the specs It should a human-oriented description of the resource.mediatype?str - A mediatype/mimetype of the resource e.g. “text/csv”, or “application/vnd.ms-excel”. Mediatypes are maintained by the Internet Assigned Numbers Authority (IANA) in a media type registry.licenses?dict[] - The license(s) under which the resource is provided. If omitted it's considered the same as the package's licenses.sources?dict[] - The raw sources for this data resource. It MUST be an array of Source objects. Each Source object MUST have a title and MAY have path and/or email properties.profile?str - A string identifying the profile of this descriptor. For example,tabular-data-resource.scheme?str - Scheme for loading the file (file, http, ...). If not set, it'll be inferred fromsource.format?str - File source's format (csv, xls, ...). If not set, it'll be inferred fromsource.hashing?str - An algorithm to hash data. It defaults to 'md5'.encoding?str - Source encoding. If not set, it'll be inferred fromsource.innerpath?str - A path within the compressed file. It defaults to the first file in the archive.compression?str - Source file compression (zip, ...). If not set, it'll be inferred fromsource.control?dict|Control - File control. For more information, please check the Control documentation.dialect?dict|Dialect - Table dialect. For more information, please check the Dialect documentation.layout?dict|Layout - Table layout. For more information, please check the Layout documentation.schema?dict|Schema - Table schema. For more information, please check the Schema documentation.stats?dict - File/table stats. A dict with the following possible properties: hash, bytes, fields, rows.basepath?str - A basepath of the resource The fullpath of the resource is joinedbasepathand /path`detector?Detector - File/table detector. For more information, please check the Detector documentation.onerror?ignore|warn|raise - Behaviour if there is an error. It defaults to 'ignore'. The default mode will ignore all errors on resource level and they should be handled by the user being available in Header and Row objects.trusted?bool - Don't raise an exception on unsafe paths. A path provided as a part of the descriptor considered unsafe if there are path traversing or the path is absolute. A path provided assourceorpathis alway trusted.package?Package - A owning this resource package. It's actual if the resource is part of some data package.
Raises:
FrictionlessException- raise any error that occurs during the process
resource.name#
Returns str: resource name
resource.title#
Returns str: resource title
resource.description#
Returns str: resource description
resource.description_html#
Returns:
str?- resource description
resource.description_text#
Returns:
str- resource description
resource.mediatype#
Returns str: resource mediatype
resource.licenses#
Returns dict[]: resource licenses
resource.sources#
Returns dict[]: resource sources
resource.profile#
Returns str: resource profile
resource.path#
Returns str: resource path
resource.data#
Returns any[][]?: resource data
resource.scheme#
Returns str: resource scheme
resource.format#
Returns str: resource format
resource.hashing#
Returns str: resource hashing
resource.encoding#
Returns str: resource encoding
resource.innerpath#
Returns str: resource compression path
resource.compression#
Returns str: resource compression
resource.control#
Returns Control: resource control
resource.dialect#
Returns Dialect: resource dialect
resource.layout#
Returns:
Layout- table layout
resource.schema#
Returns Schema: resource schema
resource.stats#
Returns dict: resource stats
resource.buffer#
File's bytes used as a sample
These buffer bytes are used to infer characteristics of the source file (e.g. encoding, ...).
Returns:
bytes?- file buffer
resource.sample#
Table's lists used as sample.
These sample rows are used to infer characteristics of the source file (e.g. schema, ...).
Returns:
list[]?- table sample
resource.labels#
Returns:
str[]?- table labels
resource.fragment#
Table's lists used as fragment.
These fragment rows are used internally to infer characteristics of the source file (e.g. schema, ...).
Returns:
list[]?- table fragment
resource.header#
Returns:
str[]?- table header
resource.basepath#
Returns str: resource basepath
resource.fullpath#
Returns str: resource fullpath
resource.detector#
Returns str: resource detector
resource.onerror#
Returns:
ignore|warn|raise- on error bahaviour
resource.trusted#
Returns:
bool- don't raise an exception on unsafe paths
resource.package#
Returns:
Package?- parent package
resource.tabular#
Returns bool: if resource is tabular
resource.byte_stream#
Byte stream in form of a generator
Yields:
gen<bytes>?- byte stream
resource.text_stream#
Text stream in form of a generator
Yields:
gen<str[]>?- text stream
resource.list_stream#
List stream in form of a generator
Yields:
gen<any[][]>?- list stream
resource.row_stream#
Row stream in form of a generator of Row objects
Yields:
gen<Row[]>?- row stream
resource.expand#
Expand metadata
resource.infer#
Infer metadata
Arguments:
stats?bool - stream file completely and infer stats
resource.open#
Open the resource as "io.open" does
Raises:
FrictionlessException- any exception that occurs
resource.close#
Close the table as "filelike.close" does
resource.closed#
Whether the table is closed
Returns:
bool- if closed
resource.read_bytes#
Read bytes into memory
Returns:
any[][]- resource bytes
resource.read_text#
Read text into memory
Returns:
str- resource text
resource.read_data#
Read data into memory
Returns:
any- resource data
resource.read_lists#
Read lists into memory
Returns:
any[][]- table lists
resource.read_rows#
Read rows into memory
Returns:
Row[]- table rows
resource.write#
Write this resource to the target resource
Arguments:
targetany|Resource - target or target resource instance**optionsdict - Resource constructor options
resource.to_dict#
Create a dict from the resource
Returns dict: dict representation
resource.to_copy#
Create a copy from the resource
Returns Resource: resource copy
resource.to_view#
Create a view from the resource
See PETL's docs for more information: https://petl.readthedocs.io/en/stable/util.html#visualising-tables
Arguments:
typelook|lookall|see|display|displayall - view's type**optionsdict - options to be passed to PETLReturns
str- resource's view
resource.to_snap#
Create a snapshot from the resource
Arguments:
jsonbool - make data types compatible with JSON formatReturns
list- resource's data
resource.to_inline#
Helper to export resource as an inline data
resource.to_pandas#
Helper to export resource as an Pandas dataframe
resource.from_petl#
Create a resource from PETL view
resource.to_petl#
Export resource as a PETL table
Row#
Row representation
| API | Usage |
|---|---|
| Public | from frictionless import Row |
Constructor of this object is not Public API
This object is returned by extract, resource.read_rows, and other functions.
Arguments:
cellsany[] - array of cellsfield_infodict - special field info structurerow_positionint - row position from 1row_numberint - row number from 1
row.cells#
Returns:
Field[]- table schema fields
row.fields#
Returns:
Field[]- table schema fields
row.field_names#
Returns:
Schema- table schema
row.field_positions#
Returns:
int[]- table field positions
row.row_position#
Returns:
int- row position from 1
row.row_number#
Returns:
int- row number from 1
row.blank_cells#
A mapping indexed by a field name with blank cells before parsing
Returns:
dict- row blank cells
row.error_cells#
A mapping indexed by a field name with error cells before parsing
Returns:
dict- row error cells
row.errors#
Returns:
Error[]- row errors
row.valid#
Returns:
bool- if row valid
row.to_str#
Returns:
str- a row as a CSV string
row.to_list#
Arguments:
jsonbool - make data types compatible with JSON formattypesstr[] - list of supported types
Returns:
dict- a row as a list
row.to_dict#
Arguments:
jsonbool - make data types compatible with JSON format
Returns:
dict- a row as a dictionary
S3Control#
S3 control representation
| API | Usage |
|---|---|
| Public | from frictionless.plugins.s3 import S3Control |
Arguments:
descriptor?str|dict - descriptorendpoint_url?string - endpoint url
Raises:
FrictionlessException- raise any error that occurs during the process
s3Control.expand#
Expand metadata
S3Loader#
S3 loader implementation.
| API | Usage |
|---|---|
| Public | from frictionless.plugins.s3 import S3Loader |
S3Plugin#
Plugin for S3
| API | Usage |
|---|---|
| Public | from frictionless.plugins.s3 import S3Plugin |
Schema#
Schema representation
| API | Usage |
|---|---|
| Public | from frictionless import Schema |
This class is one of the cornerstones of of Frictionless framework. It allow to work with Table Schema and its fields.
Arguments:
descriptor?str|dict - schema descriptorfields?dict[] - list of field descriptorsmissing_values?str[] - missing valuesprimary_key?str[] - primary keyforeign_keys?dict[] - foreign keys
Raises:
FrictionlessException- raise any error that occurs during the process
schema.missing_values#
Returns:
str[]- missing values
schema.primary_key#
Returns:
str[]- primary key field names
schema.foreign_keys#
Returns:
dict[]- foreign keys
schema.fields#
Returns:
Field[]- an array of field instances
schema.field_names#
Returns:
str[]- an array of field names
schema.add_field#
Add new field to the package.
Arguments:
sourcedict|str - a field source**optionsdict - options of the Field class
Returns:
Resource/None- addedResourceinstance orNoneif not added
schema.get_field#
Get schema's field by name.
Arguments:
namestr - schema field name
Raises:
FrictionlessException- if field is not found
Returns:
Field-Fieldinstance orNoneif not found
schema.has_field#
Check if a field is present
Arguments:
namestr - schema field name
Returns:
bool- whether there is the field
schema.remove_field#
Remove field by name.
The schema descriptor will be validated after field descriptor removal.
Arguments:
namestr - schema field name
Raises:
FrictionlessException- if field is not found
Returns:
Field/None- removedFieldinstances orNoneif not found
schema.expand#
Expand the schema
schema.read_cells#
Read a list of cells (normalize/cast)
Arguments:
cellsany[] - list of cells
Returns:
any[]- list of processed cells
schema.write_cells#
Write a list of cells (normalize/uncast)
Arguments:
cellsany[] - list of cells
Returns:
any[]- list of processed cells
schema.from_jsonschema#
Create a Schema from JSONSchema profile
Arguments:
profilestr|dict - path or dict with JSONSchema profile
Returns:
Schema- schema instance
schema.to_excel_template#
Export schema as an excel template
Arguments:
path- path of excel file to create with ".xlsx" extension
Returns:
any- excel template
Server#
Server representation
| API | Usage |
|---|---|
| Public | from frictionless import Schema |
server.start#
Start the server
Arguments:
portint - HTTP port
server.stop#
Stop the server
ServerPlugin#
Plugin for Server
| API | Usage |
|---|---|
| Public | from frictionless.plugins.server import ServerPlugin |
SpssDialect#
Spss dialect representation
| API | Usage |
|---|---|
| Public | from frictionless.plugins.spss import SpssDialect |
Arguments:
descriptor?str|dict - descriptor
Raises:
FrictionlessException- raise any error that occurs during the process
SpssParser#
Spss parser implementation.
| API | Usage |
|---|---|
| Public | from frictionless.plugins.spss import SpssParser |
SpssPlugin#
Plugin for SPSS
| API | Usage |
|---|---|
| Public | from frictionless.plugins.spss import SpssPlugin |
SqlDialect#
SQL dialect representation
| API | Usage |
|---|---|
| Public | from frictionless.plugins.sql import SqlDialect |
Arguments:
descriptor?str|dict - descriptortablestr - table nameprefixstr - prefix for all table namesorder_by?str - order_by statement passed to SQLwhere?str - where statement passed to SQLnamespace?str - SQL schemabasepath?str - a basepath, for example, for SQLite path
Raises:
FrictionlessException- raise any error that occurs during the process
SqlParser#
SQL parser implementation.
| API | Usage |
|---|---|
| Public | from frictionless.plugins.sql import SqlParser |
SqlPlugin#
Plugin for SQL
| API | Usage |
|---|---|
| Public | from frictionless.plugins.sql import SqlPlugin |
SqlStorage#
SQL storage implementation
| API | Usage |
|---|---|
| Public | from frictionless.plugins.sql import SqlStorage |
Arguments:
url?string - SQL connection stringengine?object -sqlalchemyengineprefix?str - prefix for all tablesnamespace?str - SQL scheme
Status#
Status representation.
Arguments:
descriptor?str|dict - schema descriptor
Raises:
FrictionlessException- raise any error that occurs during the process
status.version#
Returns:
str- frictionless version
status.time#
Returns:
float- transformation time
status.valid#
Returns:
bool- transformation result
status.stats#
Returns:
dict- transformation stats
status.errors#
Returns:
Error[]- transformation errors
status.tasks#
Returns:
ReportTable[]- transformation tasks
status.task#
Returns:
ReportTable- transformation task (if there is only one)
Raises:
FrictionlessException- if there are more that 1 task
StatusTask#
Status Task representation
statusTask.time#
Returns:
dict- transformation time
statusTask.valid#
Returns:
bool- transformation result
statusTask.stats#
Returns:
dict- transformation stats
statusTask.errors#
Returns:
Error[]- transformation errors
statusTask.target#
Returns:
any- transformation target
statusTask.type#
Returns:
any- transformation target
Step#
Step representation
step.transform_resource#
Transform resource
Arguments:
resourceResource - resource
Returns:
resourceResource - resource
step.transform_package#
Transform package
Arguments:
packagePackage - package
Returns:
packagePackage - package
StreamControl#
Stream control representation
| API | Usage |
|---|---|
| Public | from frictionless.plugins.stream import StreamControl |
Arguments:
descriptor?str|dict - descriptor
Raises:
FrictionlessException- raise any error that occurs during the process
StreamLoader#
Stream loader implementation.
| API | Usage |
|---|---|
| Public | from frictionless.plugins.stream import StreamLoader |
StreamPlugin#
Plugin for Local Data
| API | Usage |
|---|---|
| Public | from frictionless.plugins.stream import StreamPlugin |
System#
System representation
| API | Usage |
|---|---|
| Public | from frictionless import system |
This class provides an ability to make system Frictionless calls.
It's available as frictionless.system singletone.
system.register#
Register a plugin
Arguments:
namestr - plugin namepluginPlugin - plugin to register
system.deregister#
Deregister a plugin
Arguments:
namestr - plugin name
system.create_candidates#
Create candidates
Returns:
dict[]- an ordered by priority list of type descriptors for type detection
system.create_check#
Create check
Arguments:
descriptordict - check descriptor
Returns:
Check- check
system.create_control#
Create control
Arguments:
resourceResource - control resourcedescriptordict - control descriptor
Returns:
Control- control
system.create_dialect#
Create dialect
Arguments:
resourceResource - dialect resourcedescriptordict - dialect descriptor
Returns:
Dialect- dialect
system.create_error#
Create error
Arguments:
descriptordict - error descriptor
Returns:
Error- error
system.create_file#
Create file
Arguments:
sourceany - file sourceoptionsdict - file options
Returns:
File- file
system.create_loader#
Create loader
Arguments:
resourceResource - loader resource
Returns:
Loader- loader
system.create_parser#
Create parser
Arguments:
resourceResource - parser resource
Returns:
Parser- parser
system.create_server#
Create server
Arguments:
namestr - server nameoptionsstr - server options
Returns:
Server- server
system.create_step#
Create step
Arguments:
descriptordict - step descriptor
Returns:
Step- step
system.create_storage#
Create storage
Arguments:
namestr - storage nameoptionsstr - storage options
Returns:
Storage- storage
system.create_type#
Create type
Arguments:
fieldField - corresponding field
Returns:
Type- type
system.get_http_session#
Return a HTTP session
This method will return a new session or the session
from system.use_http_session context manager
Returns:
requests.Session- a HTTP session
system.use_http_session#
HTTP session context manager
Arguments:
http_session?requests.Session - a session; will create a new if omitted
Type#
Data type representation
| API | Usage |
|---|---|
| Public | from frictionless import Type |
This class is for subclassing.
Arguments:
fieldField - field
type.constraints#
Returns:
str[]- a list of supported constraints
type.field#
Returns:
Field- field
type.read_cell#
Convert cell (read direction)
Arguments:
cellany - cell to covert
Returns:
any- converted cell
type.write_cell#
Convert cell (write direction)
Arguments:
cellany - cell to covert
Returns:
any- converted cell
XlsParser#
XLS parser implementation.
| API | Usage |
|---|---|
| Public | `from frictionless.plugins.excel import XlsParser |
XlsxParser#
XLSX parser implementation.
| API | Usage |
|---|---|
| Public | `from frictionless.plugins.excel import XlsxParser |
checks.baseline#
Check a table for basic errors
| API | Usage |
|---|---|
| Public | from frictionless import checks |
| Implicit | validate(...) |
Ths check is enabled by default for any validate function run.
checks.deviated_value#
Check for deviated values in a field
| API | Usage |
|---|---|
| Public | from frictionless import checks |
| Implicit | validate(checks=([{"code": "deviated-value", **descriptor}]) |
This check can be enabled using the checks parameter
for the validate function.
Arguments:
descriptordict - check's descriptorfield_namestr - a field name to checkaverage?str - one of "mean", "median" or "mode" (default: "mean")interval?str - statistical interval (default: 3)
checks.duplicate_row#
Check for duplicate rows
| API | Usage |
|---|---|
| Public | from frictionless import checks |
| Implicit | validate(checks=[{"code": "duplicate-row"}]) |
This check can be enabled using the checks parameter
for the validate function.
checks.forbidden_value#
Check for forbidden values in a field
| API | Usage |
|---|---|
| Public | from frictionless import checks |
| Implicit | validate(checks=[{"code": "backlisted-value", **descriptor}]) |
This check can be enabled using the checks parameter
for the validate function.
Arguments:
descriptordict - check's descriptorfield_namestr - a field name to look intoforbiddenany[] - a list of forbidden values
checks.row_constraint#
Check that every row satisfies a provided Python expression
| API | Usage |
|---|---|
| Public | from frictionless import checks |
| Implicit | validate(checks=([{"code": "row-constraint", **descriptor}]) |
This check can be enabled using the checks parameter
for the validate function. The syntax for the row constraint
check can be found here - https://github.com/danthedeckie/simpleeval
Arguments:
descriptordict - check's descriptorformulastr - a python expression to evaluate against a row
checks.sequential_value#
Check that a column having sequential values
| API | Usage |
|---|---|
| Public | from frictionless import checks |
| Implicit | validate(checks=[{"code": "sequential-value", **descriptor}]) |
This check can be enabled using the checks parameter
for the validate function.
Arguments:
descriptordict - check's descriptorfield_namestr - a field name to check
checks.table_dimensions#
Check for minimum and maximum table dimensions
| API | Usage |
|---|---|
| Public | from frictionless import checks |
| Implicit | validate(checks=[{"code": "table-dimensions", numRows, minRows, maxRows, numFields, minFields, maxFields}]) |
Arguments:
descriptordict - check's descriptor
checks.truncated_value#
Check for possible truncated values
| API | Usage |
|---|---|
| Public | from frictionless import checks |
| Implicit | validate(checks=([{"code": "truncated-value"}]) |
This check can be enabled using the checks parameter
for the validate function.
describe#
Describe the data source
| API | Usage |
|---|---|
| Public | from frictionless import describe |
Arguments:
sourceany - data sourcetypestr - source type -schema,resourceorpackage(default: infer)**optionsdict - options for the underlaying describe function
Returns:
Package|Resource|Schema- metadata
describe_dialect#
Describe the given source as a dialect
| API | Usage |
|---|---|
| Public | from frictionless import describe_dialect |
Arguments:
sourceany - data source**optionsdict - describe resource options
Returns:
Dialect- file dialect
describe_package#
Describe the given source as a package
| API | Usage |
|---|---|
| Public | from frictionless import describe_package |
Arguments:
sourceany - data sourceexpand?bool - ifTrueit will expand the metadatastats?bool - ifTrueinfer resource's stats**optionsdict - Package constructor options
Returns:
Package- data package
describe_resource#
Describe the given source as a resource
| API | Usage |
|---|---|
| Public | from frictionless import describe_resource |
Arguments:
sourceany - data sourceexpand?bool - ifTrueit will expand the metadatastats?bool - ifTrueinfer resource's stats**optionsdict - Resource constructor options
Returns:
Resource- data resource
describe_schema#
Describe the given source as a schema
| API | Usage |
|---|---|
| Public | from frictionless import describe_schema |
Arguments:
sourceany - data source**optionsdict - describe resource options
Returns:
Schema- table schema
dicts_to_markdown_table#
Tabulate dictionaries and render as a Markdown table
errors.CellError#
Cell error representation
Arguments:
descriptor?str|dict - error descriptornotestr - an error notecellsstr[] - row cellsrow_numberint - row numberrow_positionint - row positioncellstr - errored cellfield_namestr - field namefield_numberint - field numberfield_positionint - field positionRaises
FrictionlessException- raise any error that occurs during the process
errors.CellError.from_row#
Create and error from a cell
Arguments:
rowRow - rownotestr - notefield_namestr - field name
Returns:
CellError- error
errors.HeaderError#
Header error representation
Arguments:
descriptor?str|dict - error descriptornotestr - an error notelabelsstr[] - header labelslabelstr - an errored labelfield_namestr - field namefield_numberint - field numberfield_positionint - field position
Raises:
FrictionlessException- raise any error that occurs during the process
errors.LabelError#
Label error representation
Arguments:
descriptor?str|dict - error descriptornotestr - an error notelabelsstr[] - header labelslabelstr - an errored labelfield_namestr - field namefield_numberint - field numberfield_positionint - field position
Raises:
FrictionlessException- raise any error that occurs during the process
errors.RowError#
Row error representation
Arguments:
descriptor?str|dict - error descriptornotestr - an error noterow_numberint - row numberrow_positionint - row position
Raises:
FrictionlessException- raise any error that occurs during the process
errors.RowError.from_row#
Create an error from a row
Arguments:
rowRow - rownotestr - note
Returns:
RowError- error
extract#
Extract resource rows
| API | Usage |
|---|---|
| Public | from frictionless import extract |
Arguments:
sourcedict|str - data sourcetypestr - source type - package of resource (default: infer)process?func - a row processor functionstream?bool - return a row stream(s) instead of loading into memory**optionsdict - options for the underlaying function
Returns:
Row[]|{path- Row[]}: rows in a form depending on the source type
extract_package#
Extract package rows
| API | Usage |
|---|---|
| Public | from frictionless import extract_package |
Arguments:
sourcedict|str - data resource descriptorprocess?func - a row processor functionstream?bool - return a row streams instead of loading into memory**optionsdict - Package constructor options
Returns:
{path- Row[]}: a dictionary of arrays/streams of rows
extract_resource#
Extract resource rows
| API | Usage |
|---|---|
| Public | from frictionless import extract_resource |
Arguments:
sourceany|Resource - data resourceprocess?func - a row processor function**optionsdict - Resource constructor options
Returns:
Row[]- an array/stream of rows
filter_dict#
Filter and order dictionary by key names
json_to_markdown#
Render any JSON-like object as Markdown, using nested bulleted lists
render_markdown#
Render any JSON-like object as Markdown, using jinja2 template
steps.cell_convert#
Convert cell
steps.cell_fill#
Fill cell
steps.cell_format#
Format cell
steps.cell_interpolate#
Interpolate cell
steps.cell_replace#
Replace cell
steps.cell_set#
Set cell
steps.field_add#
Add field
steps.field_filter#
Filter fields
steps.field_move#
Move field
steps.field_remove#
Remove field
steps.field_split#
Split field
steps.field_unpack#
Unpack field
steps.field_update#
Update field
steps.resource_add#
Add resource
steps.resource_remove#
Remove resource
steps.resource_transform#
Transform resource
steps.resource_update#
Update resource
steps.row_filter#
Filter rows
steps.row_search#
Search rows
steps.row_slice#
Slice rows
steps.row_sort#
Sort rows
steps.row_split#
Split rows
steps.row_subset#
Subset rows
steps.row_ungroup#
Ungroup rows
steps.table_aggregate#
Aggregate table
steps.table_attach#
Attach table
steps.table_debug#
Debug table
steps.table_diff#
Diff tables
steps.table_intersect#
Intersect tables
steps.table_join#
Join tables
steps.table_melt#
Melt tables
steps.table_merge#
Merge tables
steps.table_normalize#
Normalize table
steps.table_pivot#
Pivot table
steps.table_print#
Print table
steps.table_recast#
Recast table
steps.table_transpose#
Transpose table
steps.table_validate#
Validate table
steps.table_write#
Write table
transform#
Transform resource
| API | Usage |
|---|---|
| Public | from frictionless import transform |
Arguments:
sourceany - data sourcetypestr - source type - package, resource or pipeline (default: infer)**optionsdict - options for the underlaying function
Returns:
any- the transform result
transform_package#
Transform package
| API | Usage |
|---|---|
| Public | from frictionless import transform_package |
Arguments:
sourceany - data sourcestepsStep[] - transform steps**optionsdict - Package constructor options
Returns:
Package- the transform result
transform_pipeline#
Transform package
| API | Usage |
|---|---|
| Public | from frictionless import transform_package |
Arguments:
sourceany - a pipeline descriptor**optionsdict - Pipeline constructor options
Returns:
any- the pipeline output
transform_resource#
Transform resource
| API | Usage |
|---|---|
| Public | from frictionless import transform_resource |
Arguments:
sourceany - data sourcestepsStep[] - transform steps**optionsdict - Package constructor options
Returns:
Resource- the transform result
types.AnyType#
Any type implementation.
| API | Usage |
|---|---|
| Public | from frictionless import types |
types.ArrayType#
Array type implementation.
| API | Usage |
|---|---|
| Public | from frictionless import types |
types.BooleanType#
Boolean type implementation.
| API | Usage |
|---|---|
| Public | from frictionless import types |
types.DateType#
Date type implementation.
| API | Usage |
|---|---|
| Public | from frictionless import types |
types.DatetimeType#
Datetime type implementation.
| API | Usage |
|---|---|
| Public | from frictionless import types |
types.DurationType#
Duration type implementation.
| API | Usage |
|---|---|
| Public | from frictionless import types |
types.GeojsonType#
Geojson type implementation.
| API | Usage |
|---|---|
| Public | from frictionless import types |
types.GeopointType#
Geopoint type implementation.
| API | Usage |
|---|---|
| Public | from frictionless import types |
types.IntegerType#
Integer type implementation.
| API | Usage |
|---|---|
| Public | from frictionless import types |
types.NumberType#
Number type implementation.
| API | Usage |
|---|---|
| Public | from frictionless import types |
types.ObjectType#
Object type implementation.
| API | Usage |
|---|---|
| Public | from frictionless import types |
types.StringType#
String type implementation.
| API | Usage |
|---|---|
| Public | from frictionless import types |
types.TimeType#
Time type implementation.
| API | Usage |
|---|---|
| Public | from frictionless import types |
types.YearType#
Year type implementation.
| API | Usage |
|---|---|
| Public | from frictionless import types |
types.YearmonthType#
Yearmonth type implementation.
| API | Usage |
|---|---|
| Public | from frictionless import types |
validate#
Validate resource
| API | Usage |
|---|---|
| Public | from frictionless import validate |
Arguments:
sourcedict|str - a data sourcetypestr - source type - inquiry, package, resource, schema or table**optionsdict - options for the underlaying function
Returns:
Report- validation report
validate_inquiry#
Validate inquiry
| API | Usage |
|---|---|
| Public | from frictionless import validate_inquiry |
Arguments:
sourcedict|str - an inquiry descriptorparallel?bool - enable multiprocessing
Returns:
Report- validation report
validate_package#
Validate package
| API | Usage |
|---|---|
| Public | from frictionless import validate_package |
Arguments:
sourcedict|str - a package descriptorbasepath?str - package basepathtrusted?bool - don't raise an exception on unsafe pathsoriginal?bool - validate metadata as it is (without inferring)parallel?bool - enable multiprocessing**optionsdict - Package constructor options
Returns:
Report- validation report
validate_resource#
Validate table
| API | Usage |
|---|---|
| Public | from frictionless import validate_table |
Arguments:
sourceany - the source of the resourcechecks?list - a list of checks pick_errors? ((str|int)[]): pick errors skip_errors? ((str|int)[]): skip errorslimit_errors?int - limit errorslimit_memory?int - limit memoryoriginal?bool - validate metadata as it is (without inferring)**options?dict - Resource constructor options
Returns:
Report- validation report
validate_schema#
Validate schema
| API | Usage |
|---|---|
| Public | from frictionless import validate_schema |
Arguments:
sourcedict|str - a schema descriptor
Returns:
Report- validation report

