Results of 1 - 10 of about 28 for macro (0.002 sec.)
- CREATE MACRO Statement 14141
- The CREATE MACRO statement defines a named, callable SQL expression as a database schema object. Macros may declare parameters, which can be referenced by its expression. Once a macro is created, it may be called by referencing its name and
...by passing values to its parameters; this causes its expression to be evaluated, yielding a value. Depending on the macro type, the value may be scalar, or a TABLE value. The CREATE FUNCTION statement is an alias for CREATE MACRO . The simplifi...ed syntax for creating a macro is: CREATE [OR REPLACE] [TEMPORARY] MACRO [IF NOT EXISTS] ⟨identifier⟩( [⟨parameters⟩] ) AS [TABLE] ⟨expression⟩; The iden...tifier consists of the macro's name, which can be any valid SQL identifier. A macro may be explicitly qualified with an existing database schema. If a... - https://man.mtool.work/duckdb/2.0/sql/statements/create_macro.html
- Sharing Macros 11962
- DuckDB has a powerful macro mechanism that allows creating shorthands for common tasks. Sharing a Scalar Macro First, we define a macro that pretty-prints a non-negative integer as a short string with thousands, millions, and billions (with
...out rounding) as follows: duckdb pretty_print_integer_macro.duckdb CREATE MACRO pretty_print_integer(n) AS CASE WHEN n >= 1_000_000_000 THEN printf('%dB', n // 1_000_000_000) WHEN n...tty_print_integer(25_500_000) AS x; ┌─────────┐ │ x │ │ varchar │ ├─────────┤ │ 25M │ └─────────┘ As one would expect, the macro gets persisted in the database. But this also means that we can host it on an HTTPS endpoint and share it with anyone! We...have published this macro on blobs.duckdb.org . You can try it from DuckDB: duckdb Make sure that the httpfs extension is installed: INSTALL httpfs;... - https://man.mtool.work/duckdb/2.0/guides/snippets/sharing_macros.html
- COMMENT ON Statement 11339
- The COMMENT ON statement allows adding metadata to catalog entries (tables, columns, etc.). It follows the PostgreSQL syntax . Examples Create a comment on a TABLE : COMMENT ON TABLE test_table IS 'very nice table'; Create a comment on a CO
...IS 'very nice sequence'; Create a comment on a TYPE : COMMENT ON TYPE test_type IS 'very nice type'; Create a comment on a MACRO : COMMENT ON MACRO test_macro IS 'very nice macro'; Create a comment on a MACRO TABLE : COMMENT ON MACRO TABLE test_table_...macro IS 'very nice table macro'; To unset a comment, set it to NULL , e.g.: COMMENT ON TABLE test_table IS NULL; Reading Comments Comments can be read by...E s: SELECT comment FROM duckdb_sequences(); List comments on TYPE s: SELECT comment FROM duckdb_types(); List comments on MACRO s: SELECT comment FROM duckdb_functions(); List comments on MACRO TABLE s: SELECT comment FROM duckdb_functions(); Limitat... - https://man.mtool.work/duckdb/2.0/sql/statements/comment_on.html
- DROP Statement 9274
- The DROP statement removes a catalog entry added previously with the CREATE command. Examples Delete the table with the name tbl : DROP TABLE tbl; Drop the view with the name view1 ; do not throw an error if the view does not exist: DROP VI
...NCTION fn; Drop index idx : DROP INDEX idx; Drop schema sch : DROP SCHEMA sch; Drop sequence seq : DROP SEQUENCE seq; Drop macro mcr : DROP MACRO mcr; Drop macro table mt : DROP MACRO TABLE mt; -- the `TABLE` is optional since v1.4.0 Drop type typ : D...drop the depending object without the CASCADE modifier. Depending object type Dependent object type SCHEMA FUNCTION SCHEMA MACRO TABLE SCHEMA MACRO SCHEMA SCHEMA SCHEMA SEQUENCE SCHEMA TABLE SCHEMA TYPE SCHEMA VIEW Limitations Dependencies on Views Cu... - https://man.mtool.work/duckdb/2.0/sql/statements/drop.html
- Security 9045
- 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
...for every query. No further filtering happens. Both callbacks can be replaced with user-supplied code, including plain SQL macros. See the examples below. The Callback Contract Two settings hold the name of the function to call as a hook for authentic...function with the matching arity will work: built-in scalar functions, scalar UDFs registered by another extension, or SQL macros. Authentication takes (VARCHAR, VARCHAR, VARCHAR) , authorization takes (VARCHAR, VARCHAR) . The callbacks run in a fresh...= ...) or auto-generated). Overriding Authentication The cleanest way to plug in custom authentication is through using a MACRO . Example: Multi-Token Table Authenticate against a small table of allowed tokens (e.g., one per user): CREATE TABLE quack... - https://man.mtool.work/duckdb/2.0/quack/security.html
- Lambda Functions 8832
- DuckDB lambda functions (a.k.a. 'lambdas' or 'lambda expressions') are expressions that define an inline anonymous function. Lambdas are passed as argument to certain list functions , which evaluate the passed lambda expression against its
...a scalar expression. Additionally, it cannot contain a subquery, table function, and the like. The expression may contain macro invocations. However, only scalar macros are allowed, and only if they do not rely on a subquery. For example, the followi...da functions conform to scoping rules in the following order: inner lambda parameters outer lambda parameters column names macro parameters CREATE TABLE tbl (x INTEGER); INSERT INTO tbl VALUES (10); SELECT list_apply( [1, 2], lambda x: list_apply([4],...: (SELECT 42) + x); console Binder Error: subqueries in lambda expressions are not supported 2) The expression can contain macro calls, but only if the macro is a scalar macro. In addition, the macro must not contain a subquery or rely on another macr... - https://man.mtool.work/duckdb/2.0/sql/functions/lambda.html
- Calculating a Database Checksum 8570
- To calculate a database checksum, use a commutative operation such as bit_xor on all columns, all rows, and all tables. First, create a table macro that performs this for each table: CREATE OR REPLACE MACRO table_checksum(table_name) AS TAB
...OT ( SELECT bit_xor(md5_number(COLUMNS(*)::VARCHAR)) FROM query_table(table_name) ) ON columns(*) ); You need to call this macro for all tables. In the CLI, you can do so by dynamically generating a SQL file: .mode list .headers off .once checksum_all... - https://man.mtool.work/duckdb/2.0/guides/snippets/database_checksum.html
- Spatial Functions 7799
- Function Index Scalar Functions Function Summary DuckDB_PROJ_Compiled_Version Returns a text description of the PROJ library version that this instance of DuckDB was compiled against. DuckDB_Proj_Version Returns a text description of the PR
...MemUnion_Agg Computes the union of a set of input geometries. ST_Union_Agg Computes the union of a set of input geometries Macro Functions Function Summary ST_Rotate Alias of ST_RotateZ ST_RotateX Rotates a geometry around the X axis. This is a shorth...and macro for calling ST_Affine. ST_RotateY Rotates a geometry around the Y axis. This is a shorthand macro for calling ST_Affine. S...T_RotateZ Rotates a geometry around the Z axis. This is a shorthand macro for calling ST_Affine. ST_Scale ST_TransScale Translates and then scales a geometry in X and Y direction. This is a shorth... - https://man.mtool.work/duckdb/2.0/core_extensions/spatial/functions.html
- query and query_table Functions 7799
- The query_table and query functions enable powerful and more dynamic SQL. The query_table function returns the table whose name is specified by its string argument; the query function returns the table obtained by executing the query specif
...EXECUTE select_from_table('my_table'); i 42 When combined with the COLUMNS expression , we can write very generic SQL-only macros. For example, below is a custom version of SUMMARIZE that computes the min and max of every column in a table: CREATE OR...REPLACE MACRO my_summarize(table_name) AS TABLE SELECT unnest([*COLUMNS('alias_.*')]) AS column_name, unnest([*COLUMNS('min_.*')]) AS mi...ore flexibility. For example, users who prefer pandas' stack syntax over SQL's UNPIVOT syntax , may use: CREATE OR REPLACE MACRO stack(table_name, index, name, values) AS TABLE FROM query( 'UNPIVOT ' || table_name || ' ON COLUMNS(* EXCLUDE (' || array... - https://man.mtool.work/duckdb/2.0/guides/sql_features/query_and_query_table_func...
- DuckDB_% Metadata Functions 7750
- DuckDB offers a collection of table functions that provide metadata about the current database. These functions reside in the main schema and their names are prefixed with duckdb_ . The resultset returned by a duckdb_ table function may be
...core repository. VARCHAR duckdb_functions The duckdb_functions() function provides metadata about the functions (including macros) available in the DuckDB instance. Column Description Type database_name The name of the database that contains this func...L if this is not an alias. VARCHAR function_type The function kind. Value is one of: table , scalar , aggregate , pragma , macro , table_macro VARCHAR description Description of this function, or NULL if none is registered. VARCHAR comment A comment c...function has a variable number of arguments, or NULL if the function does not have a variable number of arguments. VARCHAR macro_definition If this is a macro , the SQL expression that defines it. VARCHAR has_side_effects false if this is a pure funct... - https://man.mtool.work/duckdb/2.0/sql/meta/duckdb_table_functions.html
DuckDB 2.0 Documentation / man.mtool.work