Results of 1 - 7 of about 7 for sqltypes (0.005 sec.)
- Types API 12777
- The DuckDBPyType class, duckdb.sqltypes.DuckDBPyType , represents one of the data types . Use DuckDBPyType to describe SQL types when declaring function parameters, return types or casts. Python types such as int are accepted too: int descr
...read as a SQL type name, such as "INTEGER" , "INT[]" , "STRUCT(a INT)" or "MAP(INT, VARCHAR)" : import duckdb from duckdb.sqltypes import DuckDBPyType print(DuckDBPyType("MAP(INT, VARCHAR)")) MAP(INTEGER, VARCHAR) A type created with CREATE TYPE exists...d Types list[child_type] list type objects map to a LIST type of the child type, which can itself be nested. import duckdb.sqltypes print(duckdb.sqltypes.DuckDBPyType(list[int])) BIGINT[] dict[key_type, value_type] dict type objects map to a MAP type of...the key type and the value type. import duckdb.sqltypes print(duckdb.sqltypes.DuckDBPyType(dict[str, int])) MAP(VARCHAR, BIGINT) {'a': field_one, 'b': field_two, ..., 'n': field_... - https://man.mtool.work/duckdb/2.0/clients/python/types.html
- Python Client API 10560
- Connection class duckdb. Appender Bases: object append_row ( self , * args ) → None Buffer one row, one value per column, each converted as an executemany parameter would be append_rows ( self , rows : object ) → None Buffer each row of an
...rs rows and inserts, upserts, updates or deletes them in the named table at each flush array_type ( self , type : _duckdb._sqltypes.DuckDBPyType , size : int ) → _duckdb._sqltypes.DuckDBPyType Create an array type object of ‘type' begin ( self ) → _duckd...ckDBPyConnection Create a duplicate of the current connection decimal_type ( self , width : int , scale : int ) → _duckdb._sqltypes.DuckDBPyType Create a decimal type with ‘width' and ‘scale' property description Get result set attributes, mainly column...te() disable_profiling ( self ) → None Disable profiling for subsequent queries dtype ( self , type_str : str ) → _duckdb._sqltypes.DuckDBPyType Create a type object by parsing the ‘type_str' string duplicate ( self ) → _duckdb.DuckDBPyConnection Create... - https://man.mtool.work/duckdb/2.0/clients/python/reference/
- Python Function API 9197
- You can create a DuckDB user-defined function (UDF) from a Python function so it can be used in SQL queries. Similarly to regular functions , they need to have a name, a return type and parameter types. Creating Functions To register a Pyth
...LL -handling. When this is not desired, you need to explicitly set this parameter to "special" . import duckdb from duckdb.sqltypes import BIGINT def dont_intercept_null(x): return 5 duckdb.create_function("dont_intercept", dont_intercept_null, [BIGINT],...ql("SELECT dont_intercept(NULL)").fetchall() print(res) [(None,)] With null_handling="special" : import duckdb from duckdb.sqltypes import BIGINT def dont_intercept_null(x): return 5 duckdb.create_function("dont_intercept_special", dont_intercept_null, [...tchall() print(res) [(5,)] Always use null_handling="special" when the function can return NULL. import duckdb from duckdb.sqltypes import VARCHAR def return_str_or_none(x: str) -> str | None: if not x: return None return x duckdb.create_function( "retur... - https://man.mtool.work/duckdb/2.0/clients/python/function.html
- Conversion between DuckDB and Python 8124
- This page documents the rules for converting DuckDB results to Python and Python objects to DuckDB . Result Conversion: DuckDB Results to Python A result is read from a relation or, when using the DB-API / con.execute() , from the connectio
...the DuckDB Value class, it's possible to set a target type, which will influence the conversion: import duckdb from duckdb.sqltypes import TINYINT con = duckdb.connect() print(con.execute("SELECT typeof(?), typeof(?), typeof(?)", [5, 2**64, duckdb.Value(...f type BIT , it maps to BIT instead, and its bytes are read as the characters 0 and 1 , as in duckdb.Value(b"0101", duckdb.sqltypes.BIT) . list list becomes a LIST type of the “most permissive” type of its children. For example, [12345, "test"] becomes V...onversion . To return a STRUCT , the return_type has to be provided: from duckdb import list_type, struct_type from duckdb.sqltypes import BOOLEAN, INTEGER, VARCHAR def get_struct() -> dict[str, str | int | list[int] | bool]: return my_struct_dict duckdb... - https://man.mtool.work/duckdb/2.0/clients/python/conversion.html
- Appender 7724
- Use an appender to insert rows that your Python code produces. It collects rows and writes them together in one SQL statement; this is called flushing. The with block below flushes on successful exit: import duckdb con = duckdb.connect() co
...CE and ON CONFLICT ), UPDATE , DELETE or MERGE INTO . A type is anything the Types API accepts, such as "INTEGER" , duckdb.sqltypes.INTEGER or int . A declared column that the statement does not read is allowed. DataFrames and other Python objects named... - https://man.mtool.work/duckdb/2.0/clients/python/appender.html
- Create Synthetic Data 7724
- DuckDB lets you quickly generate synthetic datasets by combining a few building blocks: functions and clauses that generate rows , functions that generate values to fill those rows, and extensions that generate whole benchmark datasets. Thi
...ddresses and other text, you can call the Faker Python package through the Python function API : import duckdb from duckdb.sqltypes import * from faker import Faker fake = Faker() def random_date(): return fake.date_between() def random_short_text(): ret... - https://man.mtool.work/duckdb/2.0/guides/snippets/create_synthetic_data.html
- Relational API 7433
- The Relational API builds a query one step at a time from Python. A relation, a DuckDBPyRelation , is a piece of SQL text: the methods of the Transformation and Functions sections return a new relation whose text extends the one they were c
...', 7, TRUE), (6, 'drill', 'tools', 89, TRUE) ) AS items(id, item, category, price, in_stock) """) rel.select_types([duckdb.sqltypes.VARCHAR]) Result ┌─────────────┬──────────┐ │ item │ category │ │ varchar │ varchar │ ├─────────────┼──────────┤ │ jeans │... - https://man.mtool.work/duckdb/2.0/clients/python/relational_api.html
PREV
1
NEXT
DuckDB 2.0 Documentation / man.mtool.work