duckdb-python API reference
162 public APIs from duckdb-python (duckdb/duckdb-python) — 50 classes, 94 functions, 18 methods. Signatures extracted by static analysis of the actual source.
Repository: duckdb/duckdb-python
| Kind | Count |
|---|---|
| Classes | 50 |
| Functions | 94 |
| Methods | 18 |
API list
class
adbc_driver_duckdb.StatementOptionsStatement options specific to the DuckDB driver.
func
adbc_driver_duckdb.connect(path:str | None=None) -> adbc_driver_manager.AdbcDatabaseCreate a low level ADBC connection to DuckDB.
func
adbc_driver_duckdb.dbapi.connect(path:str | None=None, **kwargs) -> 'Connection'Connect to DuckDB via ADBC.
func
adbc_driver_duckdb.driver_path() -> strGet the path to the DuckDB ADBC driver.
class
duckdb.experimental.spark.errors.exceptions.base.AnalysisExceptionFailed to analyze a SQL query plan.
class
duckdb.experimental.spark.errors.exceptions.base.IllegalArgumentExceptionPassed an illegal or inappropriate argument.
class
duckdb.experimental.spark.errors.exceptions.base.ParseExceptionFailed to parse a SQL command.
class
duckdb.experimental.spark.errors.exceptions.base.PySparkExceptionBase Exception for handling errors generated from PySpark.
method
duckdb.experimental.spark.errors.exceptions.base.PySparkException.getErrorClass() -> str | NoneReturns an error class as a string.
method
duckdb.experimental.spark.errors.exceptions.base.PySparkException.getSqlState() -> NoneReturns an SQLSTATE as a string.
class
duckdb.experimental.spark.errors.exceptions.base.PythonExceptionExceptions thrown from Python workers.
class
duckdb.experimental.spark.errors.exceptions.base.QueryExecutionExceptionFailed to execute a query.
class
duckdb.experimental.spark.errors.exceptions.base.SparkUpgradeExceptionException thrown because of Spark upgrade.
class
duckdb.experimental.spark.errors.exceptions.base.UnknownExceptionNone of the above exceptions.
class
duckdb.experimental.spark.errors.utils.ErrorClassesReaderA reader to load error information from error_classes.py.
class
duckdb.experimental.spark.sql.column.ColumnA column in a DataFrame.
method
duckdb.experimental.spark.sql.dataframe.DataFrame.alias(alias:str) -> 'DataFrame'Returns a new :class:`DataFrame` with an alias set.
method
duckdb.experimental.spark.sql.dataframe.DataFrame.columns() -> list[str]Returns all column names as a list.
method
duckdb.experimental.spark.sql.dataframe.DataFrame.filter(condition:'ColumnOrName') -> 'DataFrame'Filters rows using the given condition.
method
duckdb.experimental.spark.sql.dataframe.DataFrame.limit(num:int) -> 'DataFrame'Limits the result count to the number specified.
method
duckdb.experimental.spark.sql.dataframe.DataFrame.printSchema(level:int | None=None) -> NonePrints out the schema in the tree format.
method
duckdb.experimental.spark.sql.dataframe.DataFrame.transform(func:Callable[..., 'DataFrame'], *args:Any, **kwargs:Any) -> 'DataFrame'Returns a new :class:`DataFrame`.
func
duckdb.experimental.spark.sql.functions.abs(col:'ColumnOrName') -> ColumnComputes the absolute value.
func
duckdb.experimental.spark.sql.functions.acos(col:'ColumnOrName') -> ColumnComputes inverse cosine of the input column.
func
duckdb.experimental.spark.sql.functions.any_value(col:'ColumnOrName') -> ColumnReturns some value of `col` for a group of rows.
func
duckdb.experimental.spark.sql.functions.approxCountDistinct(col:'ColumnOrName', rsd:float | None=None) -> Column..
func
duckdb.experimental.spark.sql.functions.array(*cols:Union['ColumnOrName', list['ColumnOrName'] | tuple['ColumnOrName', ...]]) -> ColumnCreates a new array column.
func
duckdb.experimental.spark.sql.functions.array_agg(col:'ColumnOrName') -> ColumnAggregate function: returns a list of objects with duplicates.
func
duckdb.experimental.spark.sql.functions.array_compact(col:'ColumnOrName') -> ColumnCollection function: removes null values from the array.
func
duckdb.experimental.spark.sql.functions.array_max(col:'ColumnOrName') -> ColumnCollection function: returns the maximum value of the array.
func
duckdb.experimental.spark.sql.functions.array_min(col:'ColumnOrName') -> ColumnCollection function: returns the minimum value of the array.
func
duckdb.experimental.spark.sql.functions.array_size(col:'ColumnOrName') -> ColumnReturns the total number of elements in the array.
func
duckdb.experimental.spark.sql.functions.asin(col:'ColumnOrName') -> ColumnComputes inverse sine of the input column.
func
duckdb.experimental.spark.sql.functions.atan(col:'ColumnOrName') -> ColumnCompute inverse tangent of the input column.
func
duckdb.experimental.spark.sql.functions.atan2(col1:Union['ColumnOrName', float], col2:Union['ColumnOrName', float]) -> Column..
func
duckdb.experimental.spark.sql.functions.call_function(funcName:str, *cols:'ColumnOrName') -> ColumnCall a SQL function.
func
duckdb.experimental.spark.sql.functions.cbrt(col:'ColumnOrName') -> ColumnComputes the cube-root of the given value.
func
duckdb.experimental.spark.sql.functions.ceil(col:'ColumnOrName') -> ColumnComputes the ceiling of the given value.
func
duckdb.experimental.spark.sql.functions.coalesce(*cols:'ColumnOrName') -> ColumnReturns the first column that is not null.
func
duckdb.experimental.spark.sql.functions.contains(left:'ColumnOrName', right:'ColumnOrName') -> ColumnReturns a boolean.
func
duckdb.experimental.spark.sql.functions.cos(col:'ColumnOrName') -> ColumnComputes cosine of the input column.
func
duckdb.experimental.spark.sql.functions.cot(col:'ColumnOrName') -> ColumnComputes cotangent of the input column.
func
duckdb.experimental.spark.sql.functions.count(col:'ColumnOrName') -> ColumnAggregate function: returns the number of items in a group.
func
duckdb.experimental.spark.sql.functions.date_diff(end:'ColumnOrName', start:'ColumnOrName') -> ColumnReturns the number of days from `start` to `end`.
func
duckdb.experimental.spark.sql.functions.date_part(field:'ColumnOrName', source:'ColumnOrName') -> ColumnExtracts a part of the date/timestamp or interval source.
func
duckdb.experimental.spark.sql.functions.e() -> ColumnReturns Euler's number.
func
duckdb.experimental.spark.sql.functions.endswith(str:'ColumnOrName', suffix:'ColumnOrName') -> ColumnReturns a boolean.
func
duckdb.experimental.spark.sql.functions.exp(col:'ColumnOrName') -> ColumnComputes the exponential of the given value.
func
duckdb.experimental.spark.sql.functions.expr(str:str) -> ColumnParses the expression string into the column that it represents.
func
duckdb.experimental.spark.sql.functions.factorial(col:'ColumnOrName') -> ColumnComputes the factorial of the given value.
func
duckdb.experimental.spark.sql.functions.first(col:'ColumnOrName', ignorenulls:bool=False) -> ColumnAggregate function: returns the first value in a group.
func
duckdb.experimental.spark.sql.functions.floor(col:'ColumnOrName') -> ColumnComputes the floor of the given value.
func
duckdb.experimental.spark.sql.functions.hex(col:'ColumnOrName') -> ColumnComputes hex value of the given column.
func
duckdb.experimental.spark.sql.functions.hour(col:'ColumnOrName') -> ColumnExtract the hours of a given timestamp as integer.
func
duckdb.experimental.spark.sql.functions.ifnull(col1:'ColumnOrName', col2:'ColumnOrName') -> ColumnReturns `col2` if `col1` is null, or `col1` otherwise.
func
duckdb.experimental.spark.sql.functions.isnan(col:'ColumnOrName') -> ColumnAn expression that returns true if the column is NaN.
func
duckdb.experimental.spark.sql.functions.isnotnull(col:'ColumnOrName') -> ColumnReturns true if `col` is not null, or false otherwise.
func
duckdb.experimental.spark.sql.functions.isnull(col:'ColumnOrName') -> ColumnAn expression that returns true if the column is null.
func
duckdb.experimental.spark.sql.functions.last(col:'ColumnOrName', ignorenulls:bool=False) -> ColumnAggregate function: returns the last value in a group.
func
duckdb.experimental.spark.sql.functions.lcase(str:'ColumnOrName') -> ColumnReturns `str` with all characters changed to lowercase.
func
duckdb.experimental.spark.sql.functions.ln(col:'ColumnOrName') -> ColumnReturns the natural logarithm of the argument.
func
duckdb.experimental.spark.sql.functions.log2(col:'ColumnOrName') -> ColumnReturns the base-2 logarithm of the argument.
func
duckdb.experimental.spark.sql.functions.lower(col:'ColumnOrName') -> ColumnConverts a string expression to lower case.
func
duckdb.experimental.spark.sql.functions.lpad(col:'ColumnOrName', len:int, pad:str) -> ColumnLeft-pad the string column to width `len` with `pad`.
func
duckdb.experimental.spark.sql.functions.ltrim(col:'ColumnOrName') -> ColumnTrim the spaces from left end for the specified string value.
func
duckdb.experimental.spark.sql.functions.median(col:'ColumnOrName') -> ColumnReturns the median of the values in a group.
func
duckdb.experimental.spark.sql.functions.minute(col:'ColumnOrName') -> ColumnExtract the minutes of a given timestamp as integer.
func
duckdb.experimental.spark.sql.functions.mode(col:'ColumnOrName') -> ColumnReturns the most frequent value in a group.
func
duckdb.experimental.spark.sql.functions.month(col:'ColumnOrName') -> ColumnExtract the month of a given date/timestamp as integer.
func
duckdb.experimental.spark.sql.functions.negative(col:'ColumnOrName') -> ColumnReturns the negative value.
func
duckdb.experimental.spark.sql.functions.nvl(col1:'ColumnOrName', col2:'ColumnOrName') -> ColumnReturns `col2` if `col1` is null, or `col1` otherwise.
func
duckdb.experimental.spark.sql.functions.octet_length(col:'ColumnOrName') -> ColumnCalculates the byte length for the specified string column.
func
duckdb.experimental.spark.sql.functions.pi() -> ColumnReturns Pi.
func
duckdb.experimental.spark.sql.functions.positive(col:'ColumnOrName') -> ColumnReturns the value.
func
duckdb.experimental.spark.sql.functions.quarter(col:'ColumnOrName') -> ColumnExtract the quarter of a given date/timestamp as integer.
func
duckdb.experimental.spark.sql.functions.rpad(col:'ColumnOrName', len:int, pad:str) -> ColumnRight-pad the string column to width `len` with `pad`.
func
duckdb.experimental.spark.sql.functions.rtrim(col:'ColumnOrName') -> ColumnTrim the spaces from right end for the specified string value.
func
duckdb.experimental.spark.sql.functions.second(col:'ColumnOrName') -> ColumnExtract the seconds of a given date as integer.
func
duckdb.experimental.spark.sql.functions.sign(col:'ColumnOrName') -> ColumnComputes the signum of the given value.
func
duckdb.experimental.spark.sql.functions.signum(col:'ColumnOrName') -> ColumnComputes the signum of the given value.
func
duckdb.experimental.spark.sql.functions.sin(col:'ColumnOrName') -> ColumnComputes sine of the input column.
func
duckdb.experimental.spark.sql.functions.split(str:'ColumnOrName', pattern:str, limit:int=-1) -> ColumnSplits str around matches of the given pattern.
func
duckdb.experimental.spark.sql.functions.sqrt(col:'ColumnOrName') -> ColumnComputes the square root of the specified float value.
func
duckdb.experimental.spark.sql.functions.startswith(str:'ColumnOrName', prefix:'ColumnOrName') -> ColumnReturns a boolean.
func
duckdb.experimental.spark.sql.functions.std(col:'ColumnOrName') -> ColumnAggregate function: alias for stddev_samp.
func
duckdb.experimental.spark.sql.functions.stddev(col:'ColumnOrName') -> ColumnAggregate function: alias for stddev_samp.
func
duckdb.experimental.spark.sql.functions.tan(col:'ColumnOrName') -> ColumnComputes tangent of the input column.
func
duckdb.experimental.spark.sql.functions.trim(col:'ColumnOrName') -> ColumnTrim the spaces from left end for the specified string value.
func
duckdb.experimental.spark.sql.functions.try_to_timestamp(col:'ColumnOrName', format:Optional['ColumnOrName']=None) -> ColumnParses the `col` with the `format` to a timestamp.
func
duckdb.experimental.spark.sql.functions.ucase(str:'ColumnOrName') -> ColumnReturns `str` with all characters changed to uppercase.
func
duckdb.experimental.spark.sql.functions.unhex(col:'ColumnOrName') -> ColumnInverse of hex.
func
duckdb.experimental.spark.sql.functions.unix_date(col:'ColumnOrName') -> ColumnReturns the number of days since 1970-01-01.
func
duckdb.experimental.spark.sql.functions.unix_seconds(col:'ColumnOrName') -> ColumnReturns the number of seconds since 1970-01-01 00:00:00 UTC.
func
duckdb.experimental.spark.sql.functions.upper(col:'ColumnOrName') -> ColumnConverts a string expression to upper case.
func
duckdb.experimental.spark.sql.functions.variance(col:'ColumnOrName') -> ColumnAggregate function: alias for var_samp.
func
duckdb.experimental.spark.sql.functions.weekofyear(col:'ColumnOrName') -> ColumnExtract the week number of a given date as integer.
func
duckdb.experimental.spark.sql.functions.year(col:'ColumnOrName') -> ColumnExtract the year of a given date/timestamp as integer.
func
duckdb.experimental.spark.sql.functions.zeroifnull(col:'ColumnOrName') -> ColumnReturns zero if `col` is null, or `col` otherwise.
class
duckdb.experimental.spark.sql.types.ArrayTypeArray data type.
class
duckdb.experimental.spark.sql.types.BinaryTypeBinary (byte array) data type.
class
duckdb.experimental.spark.sql.types.BitstringTypeBitstring data type.
class
duckdb.experimental.spark.sql.types.BooleanTypeBoolean data type.
class
duckdb.experimental.spark.sql.types.ByteTypeByte data type, i.e.
class
duckdb.experimental.spark.sql.types.DataTypeBase class for data types.
method
duckdb.experimental.spark.sql.types.DataType.fromInternal(obj:Any) -> AnyConverts an internal SQL object into a native Python object.
method
duckdb.experimental.spark.sql.types.DataType.toInternal(obj:Any) -> AnyConverts a Python object into an internal SQL object.
class
duckdb.experimental.spark.sql.types.DataTypeSingletonMetaclass for DataType.
class
duckdb.experimental.spark.sql.types.DateTypeDate (datetime.date) data type.
class
duckdb.experimental.spark.sql.types.DayTimeIntervalTypeDayTimeIntervalType (datetime.timedelta).
class
duckdb.experimental.spark.sql.types.DecimalTypeDecimal (decimal.Decimal) data type.
class
duckdb.experimental.spark.sql.types.DoubleTypeDouble data type, representing double precision floats.
class
duckdb.experimental.spark.sql.types.FloatTypeFloat data type, representing single precision floats.
class
duckdb.experimental.spark.sql.types.FractionalTypeFractional data types.
class
duckdb.experimental.spark.sql.types.HugeIntegerTypeHuge integer data type, i.e.
class
duckdb.experimental.spark.sql.types.IntegerTypeInt data type, i.e.
class
duckdb.experimental.spark.sql.types.IntegralTypeIntegral data types.
class
duckdb.experimental.spark.sql.types.LongTypeLong data type, i.e.
class
duckdb.experimental.spark.sql.types.MapTypeMap data type.
class
duckdb.experimental.spark.sql.types.NullTypeNull type.
class
duckdb.experimental.spark.sql.types.NumericTypeNumeric data types.
class
duckdb.experimental.spark.sql.types.RowA row in :class:`DataFrame`.
method
duckdb.experimental.spark.sql.types.Row.asDict(recursive:bool=False) -> dict[str, Any]Return as a dict.
class
duckdb.experimental.spark.sql.types.ShortTypeShort data type, i.e.
class
duckdb.experimental.spark.sql.types.StringTypeString data type.
class
duckdb.experimental.spark.sql.types.StructFieldA field in :class:`StructType`.
method
duckdb.experimental.spark.sql.types.StructType.fieldNames() -> list[str]Returns all field names in a list.
method
duckdb.experimental.spark.sql.types.StructType.treeString(level:int | None=None) -> strReturns a string representation of the schema in tree format.
class
duckdb.experimental.spark.sql.types.TimeTypeTime (datetime.time) data type.
class
duckdb.experimental.spark.sql.types.TimestampTypeTimestamp (datetime.datetime) data type.
class
duckdb.experimental.spark.sql.types.UUIDTypeUUID data type.
class
duckdb.experimental.spark.sql.types.UnsignedByteTypeUnsigned byte data type, i.e.
class
duckdb.experimental.spark.sql.types.UnsignedHugeIntegerTypeUnsigned huge integer data type, i.e.
class
duckdb.experimental.spark.sql.types.UnsignedIntegerTypeUnsigned int data type, i.e.
class
duckdb.experimental.spark.sql.types.UnsignedLongTypeUnsigned long data type, i.e.
class
duckdb.experimental.spark.sql.types.UnsignedShortTypeUnsigned short data type, i.e.
class
duckdb.experimental.spark.sql.types.UserDefinedTypeUser-defined type (UDT).
method
duckdb.experimental.spark.sql.types.UserDefinedType.deserialize(datum:Any) -> NoReturnConverts a SQL datum into a user-type object.
method
duckdb.experimental.spark.sql.types.UserDefinedType.module() -> strThe Python module of the UDT.
method
duckdb.experimental.spark.sql.types.UserDefinedType.serialize(obj:Any) -> NoReturnConverts a user-type object into a SQL datum.
method
duckdb.experimental.spark.sql.types.UserDefinedType.sqlType() -> DataTypeUnderlying SQL storage type for this UDT.
class
duckdb.experimental.spark.sql.types.VariantTypeVariant (semi-structured) data type.
func
duckdb.polars_io.duckdb_source(relation:duckdb.DuckDBPyRelation, schema:pl.schema.Schema) -> pl.LazyFrameA polars IO plugin for DuckDB.
func
duckdb.udf.vectorized(func:typing.Callable[..., typing.Any]) -> typing.Callable[..., typing.Any]Decorate a function with annotated function parameters.
func
duckdb_packaging._versioning.create_git_tag(version:str, message:str | None=None, repo_path:pathlib.Path | None=None) -> NoneCreate a git tag for the given version.
func
duckdb_packaging._versioning.duckdb_tag_from_pep440(version:str) -> strMap a forced package version to a DuckDB version tag.
func
duckdb_packaging._versioning.format_version(major:int, minor:int, patch:int, post:int=0, pre:tuple[str, int] | None=None) -> strFormat version components into a version string.
func
duckdb_packaging._versioning.get_current_version() -> str | NoneGet the current version from git tags.
func
duckdb_packaging._versioning.git_tag_to_pep440(git_tag:str) -> strConvert git tag format to canonical PEP440 format.
func
duckdb_packaging._versioning.parse_version(version:str) -> tuple[int, int, int, int, tuple[str, int] | None]Parse a version string into its components.
func
duckdb_packaging._versioning.pep440_to_git_tag(version:str) -> strConvert PEP440 version to canonical git tag format.
class
duckdb_packaging.pypi_cleanup.AuthenticationErrorRaised when authentication fails.
class
duckdb_packaging.pypi_cleanup.CleanModeSupported clean-up modes.
class
duckdb_packaging.pypi_cleanup.CsrfParserHTML parser to extract CSRF tokens from PyPI forms.
method
duckdb_packaging.pypi_cleanup.PyPICleanup.run() -> intExecute the cleanup process.
class
duckdb_packaging.pypi_cleanup.PyPICleanupErrorBase exception for PyPI cleanup operations.
class
duckdb_packaging.pypi_cleanup.ValidationErrorRaised when input validation fails.
func
duckdb_packaging.pypi_cleanup.create_argument_parser() -> argparse.ArgumentParserCreate and configure the argument parser.
func
duckdb_packaging.pypi_cleanup.load_credentials() -> tuple[str | None, str | None]Load credentials from environment variables.
func
duckdb_packaging.pypi_cleanup.main() -> intMain entry point for the script.
func
duckdb_packaging.pypi_cleanup.max_nightlies_type(value:int) -> intValidate that --max-nightlies is set to a positive integer.
func
duckdb_packaging.pypi_cleanup.setup_logging(level:int=logging.INFO) -> NoneConfigure logging with appropriate level and format.
func
duckdb_packaging.pypi_cleanup.validate_username(value:str) -> strValidate and sanitize username input.
About this data
These signatures were extracted from the public source of duckdb/duckdb-python
using Python's ast module. Argument names, default values,
type annotations and return types are taken verbatim from the code.
Implementation bodies are never stored. See
how it works for details.