sdkagent

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

KindCount
Classes50
Functions94
Methods18

API list

classadbc_driver_duckdb.StatementOptions
Statement options specific to the DuckDB driver.
funcadbc_driver_duckdb.connect(path:str | None=None) -> adbc_driver_manager.AdbcDatabase
Create a low level ADBC connection to DuckDB.
funcadbc_driver_duckdb.dbapi.connect(path:str | None=None, **kwargs) -> 'Connection'
Connect to DuckDB via ADBC.
funcadbc_driver_duckdb.driver_path() -> str
Get the path to the DuckDB ADBC driver.
classduckdb.experimental.spark.errors.exceptions.base.AnalysisException
Failed to analyze a SQL query plan.
classduckdb.experimental.spark.errors.exceptions.base.IllegalArgumentException
Passed an illegal or inappropriate argument.
classduckdb.experimental.spark.errors.exceptions.base.ParseException
Failed to parse a SQL command.
classduckdb.experimental.spark.errors.exceptions.base.PySparkException
Base Exception for handling errors generated from PySpark.
methodduckdb.experimental.spark.errors.exceptions.base.PySparkException.getErrorClass() -> str | None
Returns an error class as a string.
methodduckdb.experimental.spark.errors.exceptions.base.PySparkException.getSqlState() -> None
Returns an SQLSTATE as a string.
classduckdb.experimental.spark.errors.exceptions.base.PythonException
Exceptions thrown from Python workers.
classduckdb.experimental.spark.errors.exceptions.base.QueryExecutionException
Failed to execute a query.
classduckdb.experimental.spark.errors.exceptions.base.SparkUpgradeException
Exception thrown because of Spark upgrade.
classduckdb.experimental.spark.errors.exceptions.base.UnknownException
None of the above exceptions.
classduckdb.experimental.spark.errors.utils.ErrorClassesReader
A reader to load error information from error_classes.py.
classduckdb.experimental.spark.sql.column.Column
A column in a DataFrame.
methodduckdb.experimental.spark.sql.dataframe.DataFrame.alias(alias:str) -> 'DataFrame'
Returns a new :class:`DataFrame` with an alias set.
methodduckdb.experimental.spark.sql.dataframe.DataFrame.columns() -> list[str]
Returns all column names as a list.
methodduckdb.experimental.spark.sql.dataframe.DataFrame.filter(condition:'ColumnOrName') -> 'DataFrame'
Filters rows using the given condition.
methodduckdb.experimental.spark.sql.dataframe.DataFrame.limit(num:int) -> 'DataFrame'
Limits the result count to the number specified.
methodduckdb.experimental.spark.sql.dataframe.DataFrame.printSchema(level:int | None=None) -> None
Prints out the schema in the tree format.
methodduckdb.experimental.spark.sql.dataframe.DataFrame.transform(func:Callable[..., 'DataFrame'], *args:Any, **kwargs:Any) -> 'DataFrame'
Returns a new :class:`DataFrame`.
funcduckdb.experimental.spark.sql.functions.abs(col:'ColumnOrName') -> Column
Computes the absolute value.
funcduckdb.experimental.spark.sql.functions.acos(col:'ColumnOrName') -> Column
Computes inverse cosine of the input column.
funcduckdb.experimental.spark.sql.functions.any_value(col:'ColumnOrName') -> Column
Returns some value of `col` for a group of rows.
funcduckdb.experimental.spark.sql.functions.approxCountDistinct(col:'ColumnOrName', rsd:float | None=None) -> Column
..
funcduckdb.experimental.spark.sql.functions.array(*cols:Union['ColumnOrName', list['ColumnOrName'] | tuple['ColumnOrName', ...]]) -> Column
Creates a new array column.
funcduckdb.experimental.spark.sql.functions.array_agg(col:'ColumnOrName') -> Column
Aggregate function: returns a list of objects with duplicates.
funcduckdb.experimental.spark.sql.functions.array_compact(col:'ColumnOrName') -> Column
Collection function: removes null values from the array.
funcduckdb.experimental.spark.sql.functions.array_max(col:'ColumnOrName') -> Column
Collection function: returns the maximum value of the array.
funcduckdb.experimental.spark.sql.functions.array_min(col:'ColumnOrName') -> Column
Collection function: returns the minimum value of the array.
funcduckdb.experimental.spark.sql.functions.array_size(col:'ColumnOrName') -> Column
Returns the total number of elements in the array.
funcduckdb.experimental.spark.sql.functions.asin(col:'ColumnOrName') -> Column
Computes inverse sine of the input column.
funcduckdb.experimental.spark.sql.functions.atan(col:'ColumnOrName') -> Column
Compute inverse tangent of the input column.
funcduckdb.experimental.spark.sql.functions.atan2(col1:Union['ColumnOrName', float], col2:Union['ColumnOrName', float]) -> Column
..
funcduckdb.experimental.spark.sql.functions.call_function(funcName:str, *cols:'ColumnOrName') -> Column
Call a SQL function.
funcduckdb.experimental.spark.sql.functions.cbrt(col:'ColumnOrName') -> Column
Computes the cube-root of the given value.
funcduckdb.experimental.spark.sql.functions.ceil(col:'ColumnOrName') -> Column
Computes the ceiling of the given value.
funcduckdb.experimental.spark.sql.functions.coalesce(*cols:'ColumnOrName') -> Column
Returns the first column that is not null.
funcduckdb.experimental.spark.sql.functions.contains(left:'ColumnOrName', right:'ColumnOrName') -> Column
Returns a boolean.
funcduckdb.experimental.spark.sql.functions.cos(col:'ColumnOrName') -> Column
Computes cosine of the input column.
funcduckdb.experimental.spark.sql.functions.cot(col:'ColumnOrName') -> Column
Computes cotangent of the input column.
funcduckdb.experimental.spark.sql.functions.count(col:'ColumnOrName') -> Column
Aggregate function: returns the number of items in a group.
funcduckdb.experimental.spark.sql.functions.date_diff(end:'ColumnOrName', start:'ColumnOrName') -> Column
Returns the number of days from `start` to `end`.
funcduckdb.experimental.spark.sql.functions.date_part(field:'ColumnOrName', source:'ColumnOrName') -> Column
Extracts a part of the date/timestamp or interval source.
funcduckdb.experimental.spark.sql.functions.e() -> Column
Returns Euler's number.
funcduckdb.experimental.spark.sql.functions.endswith(str:'ColumnOrName', suffix:'ColumnOrName') -> Column
Returns a boolean.
funcduckdb.experimental.spark.sql.functions.exp(col:'ColumnOrName') -> Column
Computes the exponential of the given value.
funcduckdb.experimental.spark.sql.functions.expr(str:str) -> Column
Parses the expression string into the column that it represents.
funcduckdb.experimental.spark.sql.functions.factorial(col:'ColumnOrName') -> Column
Computes the factorial of the given value.
funcduckdb.experimental.spark.sql.functions.first(col:'ColumnOrName', ignorenulls:bool=False) -> Column
Aggregate function: returns the first value in a group.
funcduckdb.experimental.spark.sql.functions.floor(col:'ColumnOrName') -> Column
Computes the floor of the given value.
funcduckdb.experimental.spark.sql.functions.hex(col:'ColumnOrName') -> Column
Computes hex value of the given column.
funcduckdb.experimental.spark.sql.functions.hour(col:'ColumnOrName') -> Column
Extract the hours of a given timestamp as integer.
funcduckdb.experimental.spark.sql.functions.ifnull(col1:'ColumnOrName', col2:'ColumnOrName') -> Column
Returns `col2` if `col1` is null, or `col1` otherwise.
funcduckdb.experimental.spark.sql.functions.isnan(col:'ColumnOrName') -> Column
An expression that returns true if the column is NaN.
funcduckdb.experimental.spark.sql.functions.isnotnull(col:'ColumnOrName') -> Column
Returns true if `col` is not null, or false otherwise.
funcduckdb.experimental.spark.sql.functions.isnull(col:'ColumnOrName') -> Column
An expression that returns true if the column is null.
funcduckdb.experimental.spark.sql.functions.last(col:'ColumnOrName', ignorenulls:bool=False) -> Column
Aggregate function: returns the last value in a group.
funcduckdb.experimental.spark.sql.functions.lcase(str:'ColumnOrName') -> Column
Returns `str` with all characters changed to lowercase.
funcduckdb.experimental.spark.sql.functions.ln(col:'ColumnOrName') -> Column
Returns the natural logarithm of the argument.
funcduckdb.experimental.spark.sql.functions.log2(col:'ColumnOrName') -> Column
Returns the base-2 logarithm of the argument.
funcduckdb.experimental.spark.sql.functions.lower(col:'ColumnOrName') -> Column
Converts a string expression to lower case.
funcduckdb.experimental.spark.sql.functions.lpad(col:'ColumnOrName', len:int, pad:str) -> Column
Left-pad the string column to width `len` with `pad`.
funcduckdb.experimental.spark.sql.functions.ltrim(col:'ColumnOrName') -> Column
Trim the spaces from left end for the specified string value.
funcduckdb.experimental.spark.sql.functions.median(col:'ColumnOrName') -> Column
Returns the median of the values in a group.
funcduckdb.experimental.spark.sql.functions.minute(col:'ColumnOrName') -> Column
Extract the minutes of a given timestamp as integer.
funcduckdb.experimental.spark.sql.functions.mode(col:'ColumnOrName') -> Column
Returns the most frequent value in a group.
funcduckdb.experimental.spark.sql.functions.month(col:'ColumnOrName') -> Column
Extract the month of a given date/timestamp as integer.
funcduckdb.experimental.spark.sql.functions.negative(col:'ColumnOrName') -> Column
Returns the negative value.
funcduckdb.experimental.spark.sql.functions.nvl(col1:'ColumnOrName', col2:'ColumnOrName') -> Column
Returns `col2` if `col1` is null, or `col1` otherwise.
funcduckdb.experimental.spark.sql.functions.octet_length(col:'ColumnOrName') -> Column
Calculates the byte length for the specified string column.
funcduckdb.experimental.spark.sql.functions.pi() -> Column
Returns Pi.
funcduckdb.experimental.spark.sql.functions.positive(col:'ColumnOrName') -> Column
Returns the value.
funcduckdb.experimental.spark.sql.functions.quarter(col:'ColumnOrName') -> Column
Extract the quarter of a given date/timestamp as integer.
funcduckdb.experimental.spark.sql.functions.rpad(col:'ColumnOrName', len:int, pad:str) -> Column
Right-pad the string column to width `len` with `pad`.
funcduckdb.experimental.spark.sql.functions.rtrim(col:'ColumnOrName') -> Column
Trim the spaces from right end for the specified string value.
funcduckdb.experimental.spark.sql.functions.second(col:'ColumnOrName') -> Column
Extract the seconds of a given date as integer.
funcduckdb.experimental.spark.sql.functions.sign(col:'ColumnOrName') -> Column
Computes the signum of the given value.
funcduckdb.experimental.spark.sql.functions.signum(col:'ColumnOrName') -> Column
Computes the signum of the given value.
funcduckdb.experimental.spark.sql.functions.sin(col:'ColumnOrName') -> Column
Computes sine of the input column.
funcduckdb.experimental.spark.sql.functions.split(str:'ColumnOrName', pattern:str, limit:int=-1) -> Column
Splits str around matches of the given pattern.
funcduckdb.experimental.spark.sql.functions.sqrt(col:'ColumnOrName') -> Column
Computes the square root of the specified float value.
funcduckdb.experimental.spark.sql.functions.startswith(str:'ColumnOrName', prefix:'ColumnOrName') -> Column
Returns a boolean.
funcduckdb.experimental.spark.sql.functions.std(col:'ColumnOrName') -> Column
Aggregate function: alias for stddev_samp.
funcduckdb.experimental.spark.sql.functions.stddev(col:'ColumnOrName') -> Column
Aggregate function: alias for stddev_samp.
funcduckdb.experimental.spark.sql.functions.tan(col:'ColumnOrName') -> Column
Computes tangent of the input column.
funcduckdb.experimental.spark.sql.functions.trim(col:'ColumnOrName') -> Column
Trim the spaces from left end for the specified string value.
funcduckdb.experimental.spark.sql.functions.try_to_timestamp(col:'ColumnOrName', format:Optional['ColumnOrName']=None) -> Column
Parses the `col` with the `format` to a timestamp.
funcduckdb.experimental.spark.sql.functions.ucase(str:'ColumnOrName') -> Column
Returns `str` with all characters changed to uppercase.
funcduckdb.experimental.spark.sql.functions.unhex(col:'ColumnOrName') -> Column
Inverse of hex.
funcduckdb.experimental.spark.sql.functions.unix_date(col:'ColumnOrName') -> Column
Returns the number of days since 1970-01-01.
funcduckdb.experimental.spark.sql.functions.unix_seconds(col:'ColumnOrName') -> Column
Returns the number of seconds since 1970-01-01 00:00:00 UTC.
funcduckdb.experimental.spark.sql.functions.upper(col:'ColumnOrName') -> Column
Converts a string expression to upper case.
funcduckdb.experimental.spark.sql.functions.variance(col:'ColumnOrName') -> Column
Aggregate function: alias for var_samp.
funcduckdb.experimental.spark.sql.functions.weekofyear(col:'ColumnOrName') -> Column
Extract the week number of a given date as integer.
funcduckdb.experimental.spark.sql.functions.year(col:'ColumnOrName') -> Column
Extract the year of a given date/timestamp as integer.
funcduckdb.experimental.spark.sql.functions.zeroifnull(col:'ColumnOrName') -> Column
Returns zero if `col` is null, or `col` otherwise.
classduckdb.experimental.spark.sql.types.ArrayType
Array data type.
classduckdb.experimental.spark.sql.types.BinaryType
Binary (byte array) data type.
classduckdb.experimental.spark.sql.types.BitstringType
Bitstring data type.
classduckdb.experimental.spark.sql.types.BooleanType
Boolean data type.
classduckdb.experimental.spark.sql.types.ByteType
Byte data type, i.e.
classduckdb.experimental.spark.sql.types.DataType
Base class for data types.
methodduckdb.experimental.spark.sql.types.DataType.fromInternal(obj:Any) -> Any
Converts an internal SQL object into a native Python object.
methodduckdb.experimental.spark.sql.types.DataType.toInternal(obj:Any) -> Any
Converts a Python object into an internal SQL object.
classduckdb.experimental.spark.sql.types.DataTypeSingleton
Metaclass for DataType.
classduckdb.experimental.spark.sql.types.DateType
Date (datetime.date) data type.
classduckdb.experimental.spark.sql.types.DayTimeIntervalType
DayTimeIntervalType (datetime.timedelta).
classduckdb.experimental.spark.sql.types.DecimalType
Decimal (decimal.Decimal) data type.
classduckdb.experimental.spark.sql.types.DoubleType
Double data type, representing double precision floats.
classduckdb.experimental.spark.sql.types.FloatType
Float data type, representing single precision floats.
classduckdb.experimental.spark.sql.types.FractionalType
Fractional data types.
classduckdb.experimental.spark.sql.types.HugeIntegerType
Huge integer data type, i.e.
classduckdb.experimental.spark.sql.types.IntegerType
Int data type, i.e.
classduckdb.experimental.spark.sql.types.IntegralType
Integral data types.
classduckdb.experimental.spark.sql.types.LongType
Long data type, i.e.
classduckdb.experimental.spark.sql.types.MapType
Map data type.
classduckdb.experimental.spark.sql.types.NullType
Null type.
classduckdb.experimental.spark.sql.types.NumericType
Numeric data types.
classduckdb.experimental.spark.sql.types.Row
A row in :class:`DataFrame`.
methodduckdb.experimental.spark.sql.types.Row.asDict(recursive:bool=False) -> dict[str, Any]
Return as a dict.
classduckdb.experimental.spark.sql.types.ShortType
Short data type, i.e.
classduckdb.experimental.spark.sql.types.StringType
String data type.
classduckdb.experimental.spark.sql.types.StructField
A field in :class:`StructType`.
methodduckdb.experimental.spark.sql.types.StructType.fieldNames() -> list[str]
Returns all field names in a list.
methodduckdb.experimental.spark.sql.types.StructType.treeString(level:int | None=None) -> str
Returns a string representation of the schema in tree format.
classduckdb.experimental.spark.sql.types.TimeType
Time (datetime.time) data type.
classduckdb.experimental.spark.sql.types.TimestampType
Timestamp (datetime.datetime) data type.
classduckdb.experimental.spark.sql.types.UUIDType
UUID data type.
classduckdb.experimental.spark.sql.types.UnsignedByteType
Unsigned byte data type, i.e.
classduckdb.experimental.spark.sql.types.UnsignedHugeIntegerType
Unsigned huge integer data type, i.e.
classduckdb.experimental.spark.sql.types.UnsignedIntegerType
Unsigned int data type, i.e.
classduckdb.experimental.spark.sql.types.UnsignedLongType
Unsigned long data type, i.e.
classduckdb.experimental.spark.sql.types.UnsignedShortType
Unsigned short data type, i.e.
classduckdb.experimental.spark.sql.types.UserDefinedType
User-defined type (UDT).
methodduckdb.experimental.spark.sql.types.UserDefinedType.deserialize(datum:Any) -> NoReturn
Converts a SQL datum into a user-type object.
methodduckdb.experimental.spark.sql.types.UserDefinedType.module() -> str
The Python module of the UDT.
methodduckdb.experimental.spark.sql.types.UserDefinedType.serialize(obj:Any) -> NoReturn
Converts a user-type object into a SQL datum.
methodduckdb.experimental.spark.sql.types.UserDefinedType.sqlType() -> DataType
Underlying SQL storage type for this UDT.
classduckdb.experimental.spark.sql.types.VariantType
Variant (semi-structured) data type.
funcduckdb.polars_io.duckdb_source(relation:duckdb.DuckDBPyRelation, schema:pl.schema.Schema) -> pl.LazyFrame
A polars IO plugin for DuckDB.
funcduckdb.udf.vectorized(func:typing.Callable[..., typing.Any]) -> typing.Callable[..., typing.Any]
Decorate a function with annotated function parameters.
funcduckdb_packaging._versioning.create_git_tag(version:str, message:str | None=None, repo_path:pathlib.Path | None=None) -> None
Create a git tag for the given version.
funcduckdb_packaging._versioning.duckdb_tag_from_pep440(version:str) -> str
Map a forced package version to a DuckDB version tag.
funcduckdb_packaging._versioning.format_version(major:int, minor:int, patch:int, post:int=0, pre:tuple[str, int] | None=None) -> str
Format version components into a version string.
funcduckdb_packaging._versioning.get_current_version() -> str | None
Get the current version from git tags.
funcduckdb_packaging._versioning.git_tag_to_pep440(git_tag:str) -> str
Convert git tag format to canonical PEP440 format.
funcduckdb_packaging._versioning.parse_version(version:str) -> tuple[int, int, int, int, tuple[str, int] | None]
Parse a version string into its components.
funcduckdb_packaging._versioning.pep440_to_git_tag(version:str) -> str
Convert PEP440 version to canonical git tag format.
classduckdb_packaging.pypi_cleanup.AuthenticationError
Raised when authentication fails.
classduckdb_packaging.pypi_cleanup.CleanMode
Supported clean-up modes.
classduckdb_packaging.pypi_cleanup.CsrfParser
HTML parser to extract CSRF tokens from PyPI forms.
methodduckdb_packaging.pypi_cleanup.PyPICleanup.run() -> int
Execute the cleanup process.
classduckdb_packaging.pypi_cleanup.PyPICleanupError
Base exception for PyPI cleanup operations.
classduckdb_packaging.pypi_cleanup.ValidationError
Raised when input validation fails.
funcduckdb_packaging.pypi_cleanup.create_argument_parser() -> argparse.ArgumentParser
Create and configure the argument parser.
funcduckdb_packaging.pypi_cleanup.load_credentials() -> tuple[str | None, str | None]
Load credentials from environment variables.
funcduckdb_packaging.pypi_cleanup.main() -> int
Main entry point for the script.
funcduckdb_packaging.pypi_cleanup.max_nightlies_type(value:int) -> int
Validate that --max-nightlies is set to a positive integer.
funcduckdb_packaging.pypi_cleanup.setup_logging(level:int=logging.INFO) -> None
Configure logging with appropriate level and format.
funcduckdb_packaging.pypi_cleanup.validate_username(value:str) -> str
Validate 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.

Back to all 805 libraries