⌘K ctrl+k
Search Shortcut cmd + k | ctrl + k
DuckDB 2.0 ドキュメント 全文検索
per page, with , order by , clip by
Results of 1 - 10 of about 39 for convert (0.002 sec.)
Conversion between DuckDB and Python 14127
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 ... lue': array([ 20. , 42.2, 2000. , 500. , 300. ]), 'count': array([ 1, 2, 1, 10, 2], dtype=int32)} Fetch as an Arrow table. Converting to Pandas afterwards just for pretty printing: tbl = con.sql("SELECT * FROM items").to_arrow_table() print(tbl.to_panda ... ch unlike pl() needs no pyarrow After con.execute() , to_arrow_table() and to_arrow_reader() first fetch the rows and then convert them, so they make an extra copy of the result, and the reader returns its first batch only after the whole query ran. The ... lars DataFrame, and pl(lazy=True) returns a Polars LazyFrame Object Conversion: Python Object to DuckDB Python objects are converted when they are passed as query parameters ( execute() , executemany() and sql(..., params=...) ), as rows of values() , a ...
https://man.mtool.work/duckdb/2.0/clients/python/conversion.html
Editing 11026
The linenoise-based CLI editor is available for macOS, Linux and Windows. DuckDB's CLI uses a line-editing library based on linenoise , which has shortcuts that are based on Emacs mode of readline . Below is a list of available commands. Yo ... trl + T Swap character under cursor with previous character Ctrl + U Delete all text Ctrl + W Delete previous word Alt + C Convert next word to titlecase Alt + D Delete next word Alt + L Convert next word to lowercase Alt + R Delete all text Alt + T Swa ... p current word with previous word Alt + U Convert next word to uppercase Alt + Backspace Delete previous word Alt + \ Delete spaces around cursor Completing Key Action Tab ...
https://man.mtool.work/duckdb/2.0/clients/cli/editing.html
TRY Expression 10446
The TRY expression ensures that errors caused by the input rows in the child (scalar) expression result in NULL for those rows, instead of causing the query to throw an error. The TRY expression was inspired by the TRY_CAST expression . Exa ... e wrapped into a TRY expression, they return NULL : Casting Without TRY SELECT 'abc'::INTEGER; Conversion Error: Could not convert string 'abc' to INT32 With TRY SELECT TRY('abc'::INTEGER); NULL Integer Division by Zero Without TRY SELECT 1 // 0; Invali ... Y WITH cte AS (FROM (VALUES ('123'), ('test'), ('235')) t(a)) SELECT a::INTEGER AS x FROM cte; Conversion Error: Could not convert string 'test' to INT32 With TRY WITH cte AS (FROM (VALUES ('123'), ('test'), ('235')) t(a)) SELECT TRY(a::INTEGER) AS x FR ...
https://man.mtool.work/duckdb/2.0/sql/expressions/try.html
Executing SQL in Python 9679
SQL queries can be executed using the duckdb.sql function. import duckdb duckdb.sql("SELECT 42").show() By default this will create a relation object. The result can be converted to various formats using the result conversion functions. For ... example, the fetchall method can be used to convert the result to Python objects. results = duckdb.sql("SELECT 42").fetchall() print(results) [(42,)] Several other result obj ... ects exist. For example, you can use df to convert the result to a Pandas DataFrame. results = duckdb.sql("SELECT 42").df() print(results) 42 0 42 By default, a global in-me ... s list or dictionary is copied when sql is called, together with any list, tuple or dictionary inside it. Other values are converted each time the relation is read, so a bytearray changed in place afterwards is read changed. To run the same parameterize ...
https://man.mtool.work/duckdb/2.0/guides/python/execute_sql.html
Casting 9287
Casting refers to the operation of converting a value in a particular data type to the corresponding value in another data type. Casting can occur either implicitly or explicitly. The syntax described here performs an explicit cast. More in ... M generate_series(1, 3) tbl(i); i 1.0 2.0 3.0 Casting Rules Not all casts are possible. For example, it is not possible to convert an INTEGER to a DATE . Casts may also throw errors when the cast could not be successfully performed. For example, trying ... g 'hello' to an INTEGER will result in an error being thrown. SELECT CAST('hello' AS INTEGER); Conversion Error: Could not convert string 'hello' to INT32 The exact behavior of the cast depends on the source and destination types. For example, when cast ... ing from VARCHAR to any other type, the string will be attempted to be converted. Casting between numeric types might have rounding implications. The applicable rounding rules can be found on the NUMER ...
https://man.mtool.work/duckdb/2.0/sql/expressions/cast.html
Run Queries 9099
Overview DuckDB-Wasm provides functions for querying data. Queries are run sequentially: First, create a connection by calling connect . Then, run queries by calling query to materialize the whole result, or send to fetch result chunks lazi ... ly. This page covers running queries, prepared statements, converting results to JSON, and exporting to Parquet. Query Execution Use query() when you want the entire result at once, or send ... ion releases its statements as well await conn.close(); Arrow Table to JSON Query results are returned as Arrow tables. To convert a result into plain JavaScript objects, map over the table's rows and call toJSON() on each: // Create a new connection co ... Query the data const arrowResult = await conn.query<{ v: arrow.Int }>(` SELECT * FROM generate_series(1, 100) t(v) `); // Convert the Arrow table to an array of JSON objects const result = arrowResult.toArray().map((row) => row.toJSON()); // Close the ...
https://man.mtool.work/duckdb/2.0/clients/wasm/query.html
ALTER TABLE Statement 9099
The ALTER TABLE statement changes the schema of an existing table in the catalog. Examples CREATE TABLE integers (i INTEGER, j INTEGER); Add a new column with name k to the table integers , it will be filled with the default value NULL : AL ... BLE integers ALTER i TYPE VARCHAR; Change the type of the column i to the type VARCHAR , using the specified expression to convert the data for each row: ALTER TABLE integers ALTER i SET DATA TYPE VARCHAR USING concat(i, '_', j); Set the default value o ... ame⟩ SET DATA TYPE ⟨type⟩ clauses. Change the type of the column i to the type VARCHAR , using the specified expression to convert the data for each row: ALTER TABLE integers ALTER i SET DATA TYPE VARCHAR USING concat(i, '_', j); The [SET [DATA]] TYPE c ... lause changes the type of a column in a table. Any data present in the column is converted according to the provided expression in the USING clause, or, if the USING clause is absent, cast to the new data type. ...
https://man.mtool.work/duckdb/2.0/sql/statements/alter_table.html
MySQL Extension 8912
The mysql extension allows DuckDB to directly read and write data from/to a running MySQL instance. The data can be queried directly from the underlying MySQL database. Data can be loaded from MySQL tables into DuckDB tables, or vice versa. ... NNECT returns the session to the local database. Settings Name Description Default mysql_bit1_as_boolean Whether or not to convert BIT(1) columns to BOOLEAN true mysql_debug_show_queries DEBUG SETTING: print all queries sent to MySQL to stdout false mys ... ime_zone Session time zone to set for newly opened connections to the MySQL server '' mysql_time_as_time Whether or not to convert MySQL's TIME columns to DuckDB's TIME false mysql_tinyint1_as_boolean Whether or not to convert TINYINT(1) columns to BOOL ...
https://man.mtool.work/duckdb/2.0/core_extensions/mysql.html
Typecasting 8912
Typecasting is an operation that converts a value in one particular data type to the closest corresponding value in another data type. Like other SQL engines, DuckDB supports both implicit and explicit typecasting. Explicit Casting Explicit ... kes as input argument a column of type DOUBLE , however, it can be called with an integer as well: sin(1) . The integer is converted into a double before being passed to the sin function. Tip To check whether a type can be implicitly cast to another typ ... a type cannot always be cast to any arbitrary target data type. The only exception is the NULL value – which can always be converted between types. The following matrix describes which conversions are supported. When implicit casting is allowed, it impl ... cast operation from INTEGER to TINYINT is supported, it is not possible for this particular value. TRY_CAST can be used to convert the value into NULL instead of throwing an error. Varchar The VARCHAR type acts as a universal target: any arbitrary value ...
https://man.mtool.work/duckdb/2.0/sql/data_types/typecasting.html
SQL Quirks 8708
Like all programming languages and libraries, DuckDB has its share of idiosyncrasies and inconsistencies. Some are vestiges of our feathered friend's evolution; others are inevitable because we strive to adhere to the SQL Standard and speci ... ction Arguments DuckDB historically allowed a bare, unbound identifier to be used as a table function argument, implicitly converting it to a string literal. For example, glob(no_such_file.csv) was treated as glob('no_such_file.csv') . Deprecated As of ... DuckDB 2.0, this implicit conversion is deprecated. By default DuckDB still converts the identifier but logs a warning; use an explicit string literal instead, for example glob('no_such_file.csv') . The beh ... avior is controlled by the table_function_identifier_conversion setting: DEFAULT : convert the identifier but log a warning. ENABLE_IMPLICIT_STRING : convert silently (the previous behavior). DISABLE_IMPLICIT_STRI ...
https://man.mtool.work/duckdb/2.0/sql/dialect/sql_quirks.html
PREV 1 2 3 4 NEXT
DuckDB 2.0 Documentation / man.mtool.work