Results of 1 - 10 of about 24 for random (0.002 sec.)
- Create Synthetic Data 15562
- 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
...ct way to produce a large number of rows: SELECT i, j FROM range(1, 3) s(i) CROSS JOIN range(1, 3) t(j); Generating Values Random Numbers random() returns a random DOUBLE in the range [0, 1) , which you can scale and cast into any numeric range: SELECT...(random() * 100)::INTEGER AS score FROM range(3); UUIDs Several utility functions generate universally unique identifiers, which m...ake good synthetic primary keys: uuid() and its alias uuidv4() generate random (version 4) UUIDs, uuidv7() generates time-ordered (version 7) UUIDs, and gen_random_uuid() is an alias for uuid() : SELEC... - https://man.mtool.work/duckdb/2.0/guides/snippets/create_synthetic_data.html
- Utility Functions 9607
- Scalar Utility Functions The functions below are difficult to categorize into specific function types and are broadly useful. Name Description alias(column) Return the name of the column. can_cast_implicitly(source_value, target_value) Whet
...asing results. force_checkpoint(database) Synchronize WAL with file for (optional) database interrupting transactions. gen_random_uuid() Return a random UUID similar to this: eeccb8c5-9943-b2bb-bb5e-222f4e14b687 . get_block_size(database) Returns the b...ot have one already. typeof(expression) Returns the name of the data type of the result of the expression. uuid() Return a random UUID (UUIDv4) similar to this: eeccb8c5-9943-b2bb-bb5e-222f4e14b687 . uuidv4() Return a random UUID (UUIDv4) similar to th...is: eeccb8c5-9943-b2bb-bb5e-222f4e14b687 . uuidv7() Return a random UUIDv7 similar to this: 81964ebe-00b1-7e1d-b0f9-43c29b6fb8f5 . uuid_extract_timestamp(uuidv7) Extracts TIMESTAMP WITH TIME... - https://man.mtool.work/duckdb/2.0/sql/functions/utility.html
- marimo Notebooks 9190
- marimo is an open-source reactive notebook for Python and SQL that's tightly integrated with DuckDB's Python client, letting you mix and match Python and SQL in a single git-versionable notebook. Unlike traditional notebooks, when you run a
...ose when they should be re-run. digits = mo.ui.slider(label="Digits", start=100, stop=10000, step=200) digits CREATE TABLE random_data AS SELECT i AS id, random() AS random_value, FROM range({digits.value}) AS t(i); SELECT * FROM random_data; Interacti... - https://man.mtool.work/duckdb/2.0/guides/python/marimo.html
- Multiple Python Threads 9190
- This page demonstrates how to simultaneously insert into and read from a DuckDB database across multiple Python threads. This could be useful in scenarios where new data is flowing in and an analysis should be periodically re-run. Note that
...when that insert occurred using the DEFAULT expression . import duckdb from threading import Thread, current_thread import random duckdb_con = duckdb.connect('my_persistent_db.duckdb') # Use connect without parameters for an in-memory database # duckdb...ill be created. Then, create first writer and then reader threads. Next, shuffle them so that they will be kicked off in a random order to simulate simultaneous writers and readers. Note that the threads have not yet been executed, only defined. write_...ead, args = (duckdb_con,), name = 'read_thread_' + str(j))) # Shuffle the threads to simulate a mix of readers and writers random.seed(6) # Set the seed to ensure consistent results when testing random.shuffle(threads) Run Threads and Show Results Now,... - https://man.mtool.work/duckdb/2.0/guides/python/multiple_threads.html
- Interval Type 9124
- INTERVAL s represent periods of time that can be added to or subtracted from DATE , TIMESTAMP , TIMESTAMPTZ , or TIME values. Name Description INTERVAL Period of time An INTERVAL can be constructed by providing amounts together with units.
...aller of these three basis units. SELECT INTERVAL 1 YEAR, -- single unit using YEAR keyword; stored as 12 months INTERVAL (random() * 10) YEAR, -- parentheses necessary for variable amounts; -- stored as integer number of months INTERVAL '1 month 1 day...s not split into additional units. To demonstrate this, the following query generates an INTERVAL called period by summing random amounts of the three basis units. It then extracts the aforementioned six parts from period , adds them back together, and...ar', 'month', 'day', 'hour', 'minute', 'microsecond'] ], lambda i1, i2: i1 + i2 ) -- always true FROM ( VALUES ( INTERVAL (random() * 123_456_789_123) MICROSECONDS + INTERVAL (random() * 12_345) DAYS + INTERVAL (random() * 12_345) MONTHS ) ) _(period);... - https://man.mtool.work/duckdb/2.0/sql/data_types/interval.html
- Numeric Functions 8990
- Numeric Operators The table below shows the available mathematical operators for numeric types . Operator Description Example Result + Addition 2 + 3 5 - Subtraction 2 - 3 -1 * Multiplication 2 * 3 6 / Float division 5 / 2 2.5 // Division 5
...es x to the power of y . power(x, y) Alias of pow . Computes x to the power of y . radians(x) Converts degrees to radians. random() Returns a random number x in the range 0.0 <= x < 1.0 . round_even(v NUMERIC, s INTEGER) Alias of roundbankers(v, s) . R...und(v NUMERIC, s INTEGER) Round to s decimal places. Values s < 0 are allowed. setseed(x) Sets the seed to be used for the random function. sign(x) Returns the sign of x as -1, 0 or 1. signbit(x) Returns whether the signbit is set or not. sin(x) Comput...| 8 | radians(x) | Description | Converts degrees to radians. | | Example | radians(90) | | Result | 1.5707963267948966 | random() | Description | Returns a random number x in the range 0.0 <= x < 1.0 . | | Example | random() | | Result | various | ro... - https://man.mtool.work/duckdb/2.0/sql/functions/numeric.html
- Python Function API 8440
- 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
...nctions are expected to produce the same result for the same input. If the result of a function is impacted by any type of randomness, side_effects must be set to True . A type given as a string, such as "INTEGER" or the name of a type created with CRE...output when given the same input. If your function does not follow that rule, for example when your function makes use of randomness, then you will need to mark this function as having side_effects . For example, this function will produce a new count...es that don't operate on Arrow, such as faker : import duckdb from duckdb.sqltypes import DATE from faker import Faker def random_date(): fake = Faker() return fake.date_between() duckdb.create_function( "random_date", random_date, parameters=[], retur... - https://man.mtool.work/duckdb/2.0/clients/python/function.html
- Loops 8306
- Loops can be used in sqllogictests when it is required to execute the same query many times but with slight modifications in constant values. For example, suppose we want to fire off 100 queries that check for the presence of the values 0..
...ith clever use of cross products and other expressions, many different types of datasets can be efficiently generated. The random() function can also be used to generate random data. An alternative option is to read data from an existing CSV or Parquet... - https://man.mtool.work/duckdb/2.0/dev/sqllogictest/loops.html
- Overview 8173
- How is DuckDB Tested? Testing is vital to make sure that DuckDB works properly and keeps working properly. For that reason, we put a large emphasis on thorough and frequent testing: * We run a batch of small tests on every commit using GitH
...nch. * We use a fuzzer , which automatically reports issues found through fuzzing DuckDB. * We use SQLsmith for generating random queries.... - https://man.mtool.work/duckdb/2.0/dev/sqllogictest/overview.html
- Security 8090
- This page covers Quack's security posture end to end: what the server exposes, what stays local, the role of a TLS-terminating reverse proxy, and the authentication / authorization callbacks the server runs on every connection and every que
...s to supply on every connection. Unless a token is passed explicitly or supplied by a quack secret, the server generates a random token at startup. The server binds to localhost only, non-local hostnames require an explicit allow_other_hostname = true...k_serve(uri, token = '...') , otherwise the token of a matching (or the default) quack secret, otherwise a newly generated random token, and returns it in the auth_token column. Clients have to present this token on every connection, either through a q...sion_id⟩, ⟨client_token⟩, ⟨server_token⟩); The arguments are defined as follows: session_id : Server-generated session id (random 32-char string). Becomes the quack_connection_id for that client. client_token : The token the client sent. server_token :... - https://man.mtool.work/duckdb/2.0/quack/security.html
DuckDB 2.0 Documentation / man.mtool.work