Skip to main content
Run a Python script. The script is executed in-process by the Python 3 interpreter.
The version of Python currently used by the component is 3.10.
Any output written via print statements will appear as the task completion message, and so output should be brief. While it is valid to handle exceptions within the script using try/except, any uncaught exceptions will cause the component to be marked as failed and its failure link to be followed. You may import any modules from the Python Standard Library. Optionally, you may also import your own Python libraries. To do this, you need to specify the location of your libraries in the environment variable EXTENSION_LIBRARY_LOCATION. For more information on this, read Optional agent parameters. To use these additional Python libraries, you will need to include appropriate imports in your Python script, following standard Python practice. If the component requires access to a cloud provider, by default the component will inherit the agent’s execution role (service account role). However, if there are cloud credentials associated to your environment, these will overwrite the role. This component supports the use of pipeline and project variables. For more information, read Variables.
Currently, this component is not usable on Matillion Full SaaS infrastructure. See the Python Pushdown component for a way to run Python scripts in your own Snowflake environment if you have a Full SaaS solution.

Properties

Name
string
required
A human-readable name for the component.
Script
code editor
required
The Python script to execute.
Interpreter
drop-down
required
Set this to Python 3.
Timeout
integer
required
The number of seconds to wait for script termination. After the set number of seconds has elapsed, the script is forcibly terminated. The default is 300 seconds (5 minutes).

Script best practices

In a Python script, it’s possible to stream all of the output of a massive curl request to the log output. However, we don’t recommend this practice. Streaming all of the data to the log means that the data leaves your own infrastructure and is stored in log files in , breaking data sovereignty. Best practice, therefore, is to use the script to retrieve the data and then load it into an S3 bucket or some other storage of your choice, bypassing the Matillion logs. If your Python script results in a log file of more than 300 KB being written, the script will execute successfully but the component will truncate the log file and log the message *** WARNING: log output too large. Only returning the last 300 KB **** : <contents>

Default libraries

The following libraries are available by default in the Python Script component:
a-dd-nn-ss-z
abcdistutilsnntplibslugify
agatedoctestntpathsmtpd
aifcdocutilsnturl2pathsmtplib
annotated_typesdsi_pydantic_shimnumberssndhdr
antigravityemailnumpysnowplow_tracker
apiclientencodingsoauthlibsocket
aptenumopcodesocketserver
apt_insterrnoopenpyxlsoftwareproperties
apt_pkget_xmlfileOpenSSLsortedcontainers
aptsourcesfaulthandleroperatorsoupsieve
argparsefcntloptparsespwd
arrayfilecmpordered_setsqlite3
asn1cryptofileinputossqlparams
astfilelockossaudiodevsqlparse
asynchatfnmatchpackagingsre_compile
asynciofractionspandassre_constants
asyncoreftplibpandas_gbqsre_parse
atexitfunctoolsparsedatetimessl
attrfuturepathlibstat
attrsgcpathspecstatistics
audioopgenericpathpdbstring
autocommandgetoptpicklestringprep
awscligetpasspickletoolsstruct
azure_identitygettextpipsubprocess
azure_keyvault_secretsgipipessunau
babelglobpkg_resourcessymtable
backportsgoogle_auth_httplib2pkgutilsys
base64google_auth_oauthlibplatformsysconfig
bdbgoogle_crc32cplatformdirssyslog
binasciigoogleapiclientplistlibtabnanny
binhexgraphlibpoplibtarfile
bisectgrpposixtelnetlib
blinkergrpcposixpathtempfile
boto3grpc_statuspprinttermios
botocoregzipprofiletest
bs4hashlibprototext_unidecode
builtinsheapqpstatstextwrap
bz2hmacpsycopg2this
cachetoolshtmlptythreading
cairohttppwdthrift
calendarhttplib2py_compiletime
certifiidnapyarrowtimeit
cffiimaplibpyasn1token
cgiimghdrpyasn1_modulestokenize
cgitbimppyclbrtomli
chardetimportlibpycparsertomlkit
charset_normalizerimportlib_metadatapydantictrace
chunkinflectpydantic_coretraceback
clickinspectpydata_google_authtracemalloc
cmathiopydoctty
cmdipaddresspydoc_dataturtle
codeisodatepyexpattypeguard
codecsitertoolspygtkcompattypes
codeopjeepneypyparsingtyping
collectionsjinja2pytimeparsetyping_extensions
coloramajmespathpytztyping_inspection
colorsysjsonqueuetzdata
compilealljsonschemaquopriunicodedata
concurrentjsonschema_specificationsrandomunittest
configparserjwtreuritemplate
contextlibkeyringreadlineurllib
contextvarskeywordredshift_connectorurllib3
copylaunchpadlibreferencinguu
copyregleatherreprlibuuid
cProfilelib2to3requestsvenv
cryptlinecacherequests_oauthlibwadllib
cryptographylocaleresourcewarnings
csvloggingrlcompleterwave
ctypeslsb_releaseromanweakref
curseslxmlrpdswebbrowser
dafflz4rsawheel
databrickslzmarunpywsgiref
dataclassesmailboxs3transferxdrlib
datetimemailcapschedxml
dateutilmarkupsafescrampxmlrpc
db_dtypesmarshalsecretsxxlimited
dbmmashumarosecretstoragexxlimited_35
dbtmathselectxxsubtype
dbt_commonmimetypesselectorsyaml
dbt_extractormmapsetuptoolszipapp
dbt_semantic_interfacesmodulefindershelvezipfile
dbusmore_itertoolsshlexzipimport
decimalmsgpackshutilzipp
deepdiffmultiprocessingsignalzlib
difflibnetrcsitezoneinfo
disnetworkxsitecustomize
distronissix