Results of 1 - 10 of about 11 for datetime (0.002 sec.)
- Conversion between DuckDB and Python 14065
- 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
...ection below says otherwise. This is a mapping of Python object types to DuckDB Logical Types : None → NULL bool → BOOLEAN datetime.timedelta → INTERVAL str → VARCHAR bytearray → BLOB memoryview → BLOB decimal.Decimal → DECIMAL / DOUBLE / FLOAT uuid.UUID..., [5, 2**64, duckdb.Value(5, TINYINT)]).fetchall()) [('INTEGER', 'HUGEINT', 'TINYINT')] float A float is always a DOUBLE . datetime.datetime For datetime we will check pandas.isnull if it's available and return NULL if it returns true . If the datetime h...s not installed with DuckDB; without it, the fetch raises InvalidInputException: Required module 'pytz' failed to import . datetime.datetime.max and datetime.datetime.min convert to ordinary timestamps, not to infinity. In the other direction, the timest... - https://man.mtool.work/duckdb/2.0/clients/python/conversion.html
- Schema 10171
- Types It is important to use the correct type for encoding columns (e.g., BIGINT , DATE , DATETIME ). While it is always possible to use string types ( VARCHAR , etc.) to encode more specific values, this is not recommended. Strings use mor
...ple aggregation query that returns the average day-of-the month from the timestamps in two configurations. First, we use a DATETIME to encode the values and run the query using the extract datetime function : SELECT avg(extract('day' FROM creationDate))...ate[9:10] AS INTEGER)) FROM Comment; The results of the microbenchmark are as follows: Column type Storage size Query time DATETIME 3.3 GB 0.9 s VARCHAR 5.2 GB 3.9 s The results show that using the DATETIME value yields smaller storage sizes and faster p... - https://man.mtool.work/duckdb/2.0/guides/performance/schema.html
- Indexing 9193
- DuckDB has two types of indexes: zonemaps and ART indexes. Zonemaps DuckDB automatically creates zonemaps (also known as min-max indexes) for the columns of all general-purpose data types . Operations like predicate pushdown into scan opera
...ns when inserting it. Even an imperfect ordering will still be helpful. The best case of ordered data commonly arises with DATETIME columns. Microbenchmark: The Effect of Ordering For an example, let's repeat the microbenchmark for timestamps with an ord...ered timestamp column using an ascending order vs. an unordered one. Column type Ordered Storage size Query time DATETIME yes 1.3 GB 0.6 s DATETIME no 3.3 GB 0.9 s The results show that simply keeping the column order allows for improved compre... - https://man.mtool.work/duckdb/2.0/guides/performance/indexing.html
- My Workload Is Slow 8446
- If you find that your workload in DuckDB is slow, we recommend performing the following checks. More detailed instructions are linked for each point. Do you have enough memory? DuckDB works best if you have 1-4 GB memory per thread . Is you
...ing them , which boosts load and update performance. Are you using the correct types? For example, use TIMESTAMP to encode datetime values . Are you reading from Parquet files? If so, do they have row group sizes between 100k and 1M and file sizes betwee... - https://man.mtool.work/duckdb/2.0/guides/performance/my_workload_is_slow.html
- Date Functions 8357
- This section describes functions and operators for examining and manipulating DATE values. Date Operators The table below shows the available mathematical operators for DATE types. Operator Description Example Result + addition of days (int
...tamp functions through type promotion. Name Description date_add(date, interval) Add the interval to the date and return a DATETIME value. date_diff(part, startdate, enddate) The number of part boundaries between startdate and enddate , inclusive of the...nt transaction) in the local time zone. date_add(date, interval) | Description | Add the interval to the date and return a DATETIME value. | | Example | date_add(DATE '1992-09-15', INTERVAL 2 MONTH) | | Result | 1992-11-15 00:00:00 | date_diff(part, star... - https://man.mtool.work/duckdb/2.0/sql/functions/date.html
- Data Types 8055
- General-Purpose Data Types The table below shows all the built-in general-purpose data types. The alternatives listed in the aliases column can be used to refer to these types as well, however, note that the aliases are not part of the SQL
...(no time zone) TIMESTAMP WITH TIME ZONE TIMESTAMPTZ Combination of time and date that uses the current time zone TIMESTAMP DATETIME Combination of time and date TINYINT INT1 Signed one-byte integer UBIGINT Unsigned eight-byte integer UHUGEINT Unsigned si... - https://man.mtool.work/duckdb/2.0/sql/data_types/overview.html
- Python Function API 7912
- 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
...[], return_type=DATE, type="native", side_effects=True, ) res = duckdb.sql("SELECT random_date()").fetchall() print(res) [(datetime.date(2019, 5, 15),)]... - https://man.mtool.work/duckdb/2.0/clients/python/function.html
- Timestamp Types 7912
- Timestamps represent points in time. As such, they combine DATE and TIME information. They can be created using the type name followed by a string formatted according to the ISO 8601 format, YYYY-MM-DD hh:mm:ss[.zzzzzzzzz][+-TT[:tt]] , whic
...ion are ignored. Timestamp Types Name Aliases Description TIMESTAMP_NS Naive timestamp with nanosecond precision TIMESTAMP DATETIME , TIMESTAMP WITHOUT TIME ZONE Naive timestamp with microsecond precision TIMESTAMP_MS Naive timestamp with millisecond pre... - https://man.mtool.work/duckdb/2.0/sql/data_types/timestamp.html
- Text Functions 7912
- Text Functions and Operators This section describes functions and operators for examining and manipulating STRING values . Function Description string[index] Extracts a single character using a (1-based) index . string[begin:end] Extracts a
...ormat('{} + {} = {}', 3, 5, 3 + 5); -- 3 + 5 = 8 Booleans: SELECT format('{} != {}', true, false); -- true != false Format datetime values: SELECT format('{}', DATE '1992-01-01'); -- 1992-01-01 SELECT format('{}', TIME '12:01:00'); -- 12:01:00 SELECT for...rintf('%d + %d = %d', 3, 5, 3 + 5); -- 3 + 5 = 8 Booleans: SELECT printf('%s != %s', true, false); -- true != false Format datetime values: SELECT printf('%s', DATE '1992-01-01'); -- 1992-01-01 SELECT printf('%s', TIME '12:01:00'); -- 12:01:00 SELECT pri... - https://man.mtool.work/duckdb/2.0/sql/functions/text.html
- Information Schema 7912
- The views in the information_schema are SQL-standard views that describe the catalog entries of the database. These views can be filtered to obtain information about a specific column or table. DuckDB's implementation is based on PostgreSQL
...he scale indicates the number of digits after the decimal point. For all other data types, this column is NULL . INTEGER 2 datetime_precision If data_type identifies a date, time, timestamp, or interval type, this column contains the (declared or implici... - https://man.mtool.work/duckdb/2.0/sql/meta/information_schema.html
DuckDB 2.0 Documentation / man.mtool.work