Results of 1 - 9 of about 9 for item (0.005 sec.)
- Relational API 13984
- 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
...ry once and keep its rows, call materialize() : import duckdb duckdb_conn = duckdb.connect() duckdb_conn.sql("CREATE TABLE items (id INTEGER)") counted = duckdb_conn.sql("SELECT count(*) AS n FROM items") held = counted.materialize() duckdb_conn.sql(..."INSERT INTO items VALUES (1), (2)") print(counted.fetchall(), held.fetchall()) [(2,)] [(0,)] Relation Creation This section contains the de...', 65, TRUE), (4, 'hammer', 'tools', 42, TRUE), (5, 'screwdriver', 'tools', 7, TRUE), (6, 'drill', 'tools', 89, TRUE) ) AS items(id, item, category, price, in_stock) """) rel.set_alias("my_relation").alias Result 'my_relation' columns Return a list c... - https://man.mtool.work/duckdb/2.0/clients/python/relational_api.html
- R Client 8915
- Installation To use the DuckDB R client, visit the R installation page . The latest stable version of the DuckDB R client is 2.0.0. Installation duckdb : R Client The DuckDB R client can be installed using the following command: install.pac
...used for queries that produce results (e.g., SELECT ). Below is an example. # create a table dbExecute(con, "CREATE TABLE items (item VARCHAR, value DECIMAL(10, 2), count INTEGER)") # insert two items into the table dbExecute(con, "INSERT INTO items...VALUES ('jeans', 20.0, 1), ('hammer', 42.2, 2)") # retrieve the items again res <- dbGetQuery(con, "SELECT * FROM items") print(res) # item value count # 1 jeans 20.0 1 # 2 hammer 42.2 2 Duck...nd dbGetQuery methods. Here is an example: # prepared statement parameters are given as a list dbExecute(con, "INSERT INTO items VALUES (?, ?, ?)", list('laptop', 2000, 1)) # if you want to reuse a prepared statement multiple times, use dbSendStateme... - https://man.mtool.work/duckdb/2.0/clients/r.html
- Conversion between DuckDB and Python 8789
- 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
...ython guides for more. To run the examples, use this table: import duckdb con = duckdb.connect() con.execute("CREATE TABLE items (item VARCHAR, value DECIMAL(10, 2), count INTEGER)") con.execute(""" INSERT INTO items VALUES ('jeans', 20.0, 1), ('hamm...2000.0, 1), ('chainsaw', 500.0, 10), ('iphone', 300.0, 2) """) Fetch as Pandas DataFrame: df = con.execute("SELECT * FROM items").df() print(df) item value count 0 jeans 20.0 1 1 hammer 42.2 2 2 laptop 2000.0 1 3 chainsaw 500.0 10 4 iphone 300.0 2 F...etch as dictionary of NumPy arrays: arr = con.execute("SELECT * FROM items").fetchnumpy() print(arr) {'item': array(['jeans', 'hammer', 'laptop', 'chainsaw', 'iphone'], dtype=object), 'value': arr... - https://man.mtool.work/duckdb/2.0/clients/python/conversion.html
- Python DB API 8592
- The standard DuckDB Python API provides a SQL interface compliant with the DB-API 2.0 specification described by PEP 249 similar to the SQLite Python API . Connection To use the module, you must first create a DuckDBPyConnection object that
...mPy arrays. Below are some short examples: import duckdb con = duckdb.connect() # create a table con.execute("CREATE TABLE items (item VARCHAR, value DECIMAL(10, 2), count INTEGER)") # insert two items into the table con.execute("INSERT INTO items VA...LUES ('jeans', 20.0, 1), ('hammer', 42.2, 2)") print(con.rowcount) # retrieve the items again con.execute("SELECT * FROM items") print(con.fetchall()) # retrieve the items one at a time con.execute("SELECT * F...ROM items") print(con.fetchone()) print(con.fetchmany(5)) print(con.fetchone()) 2 [('jeans', Decimal('20.00'), 1), ('hammer', Decim... - https://man.mtool.work/duckdb/2.0/clients/python/dbapi.html
- Migrating Python Code to DuckDB 2.0 8178
- This page lists what Python code written for DuckDB 1.x must change to run on DuckDB 2.0. Each item gives the 1.x form, the 2.0 form and the page that explains it. For changes outside the Python client, see Migrating to DuckDB v2.0 . Python
... - https://man.mtool.work/duckdb/2.0/clients/python/migration.html
- Jupyter Notebooks 8178
- DuckDB's Python client can be used directly in Jupyter notebooks with no additional configuration, as the first section shows. Additional libraries can simplify SQL query development; the rest of this guide uses the JupySQL package. See oth
...l runs a query and finds a pandas DataFrame by its variable name: import duckdb import pandas as pd sales = pd.DataFrame({"item": ["jeans", "hammer"], "price": [20, 42]}) duckdb.sql("SELECT * FROM sales WHERE price > 30") The last expression displays... - https://man.mtool.work/duckdb/2.0/guides/python/jupyter.html
- Run Queries 8124
- Overview Java applications send queries and read result sets through the familiar Statement , PreparedStatement , and ResultSet interfaces. This page covers sending queries and reading DuckDB's nested and composite types. For opening the Co
...nager.getConnection("jdbc:duckdb:"); // create a table Statement stmt = conn.createStatement(); stmt.execute("CREATE TABLE items (item VARCHAR, value DECIMAL(10, 2), count INTEGER)"); // insert two items into the table stmt.execute("INSERT INTO items...VALUES ('jeans', 20.0, 1), ('hammer', 42.2, 2)"); try (ResultSet rs = stmt.executeQuery("SELECT * FROM items")) { while (rs.next()) { System.out.println(rs.getString(1)); System.out.println(rs.getInt(3)); } } stmt.close(); jeans 1...s as per the JDBC API: import java.sql.PreparedStatement; try (PreparedStatement stmt = conn.prepareStatement("INSERT INTO items VALUES (?, ?, ?);")) { stmt.setString(1, "chainsaw"); stmt.setDouble(2, 500.0); stmt.setInt(3, 42); stmt.execute(); // mo... - https://man.mtool.work/duckdb/2.0/clients/java/querying.html
- Expression API 8088
- The Expression class represents an instance of an expression . Why Would I Use the Expression API? Use expressions to build filters and computed columns in Python. They are useful when column names or conditions depend on your code. import
...duckdb import pandas as pd from duckdb import col sales = pd.DataFrame({"item": ["jeans", "hammer"], "price": [20, 42]}) price_column = "price" rel = duckdb.from_df(sales) print(rel.filter(col(price_c... - https://man.mtool.work/duckdb/2.0/clients/python/expression.html
- Python Client API 7962
- 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
...: ValueOrExpr ) → Expression The values gathered into a list. SQL: array_agg . as_order ( ) → str The SQL for an ORDER BY item, carrying the direction and the null order where they were asked for. as_select ( ) → str The SQL for a select list, carry... - https://man.mtool.work/duckdb/2.0/clients/python/reference/
PREV
1
NEXT
DuckDB 2.0 Documentation / man.mtool.work