File: logging_file_bind_replace.test

package info (click to toggle)
duckdb 1.5.1-3
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 299,196 kB
  • sloc: cpp: 865,414; ansic: 57,292; python: 18,871; sql: 12,663; lisp: 11,751; yacc: 7,412; lex: 1,682; sh: 747; makefile: 564
file content (107 lines) | stat: -rw-r--r-- 2,378 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# name: test/sql/logging/logging_file_bind_replace.test
# description: Test file-backed log storage with the duckdb_logs() and duckdb_log_contexts() functions
# group: [logging]

require noforcestorage

# Due to different file locking behaviour, this currently fails on windows
require notwindows

# Enable FileSystem logging to single csv file (note that normalize is implicit here)  
statement ok
CALL enable_logging(['QueryLog'], storage_path='__TEST_DIR__/logging_file_bind_replace_log.csv');

# Read some data to trigger FileSystem log
statement ok
SELECT 1 as a

statement ok
FROM duckdb_logs_parsed('FileSystem');

statement ok
CALL disable_logging();

query IIIIII nosort describe_duckdb_logs
DESCRIBE FROM duckdb_logs;
----

query I
SELECT message FROM duckdb_logs_parsed('QueryLog') WHERE starts_with(message, 'SELECT 1');
----
SELECT 1 as a

query I
SELECT message FROM duckdb_logs_parsed('querylog') WHERE starts_with(message, 'SELECT 1');
----
SELECT 1 as a

statement ok
CALL truncate_duckdb_logs();

# Enable FileSystem logging to double csv file  
statement ok
CALL enable_logging(['QueryLog'], storage='file', storage_config={'path': '__TEST_DIR__/logging_file_bind_replace_normalized/', 'normalize': true});

# Trigger log
statement ok
SELECT 1 as b

statement ok
FROM duckdb_logs

statement ok
CALL disable_logging();

query IIIIII nosort describe_duckdb_logs
DESCRIBE FROM duckdb_logs
----

query I
SELECT message FROM duckdb_logs_parsed('QueryLog') WHERE starts_with(message, 'SELECT 1');
----
SELECT 1 as b

statement ok
CALL truncate_duckdb_logs();

# Now rerun with the in-memory storage to ensure everything matches up
statement ok
CALL enable_logging(['QueryLog'], storage='memory');

statement ok
SELECT 1 as c

statement ok
CALL disable_logging();

query IIIIII nosort describe_duckdb_logs
DESCRIBE FROM duckdb_logs
----

query I
SELECT message FROM duckdb_logs_parsed('QueryLog') WHERE starts_with(message, 'SELECT 1');
----
SELECT 1 as c

statement ok
CALL truncate_duckdb_logs();

# Now rerun with all log types enabled 

statement ok
CALL enable_logging(level='trace', storage='memory');

statement ok
SELECT 1 as d

statement ok
CALL disable_logging();

query IIIIII nosort describe_duckdb_logs
DESCRIBE FROM duckdb_logs
----

query I
SELECT message FROM duckdb_logs_parsed('QueryLog') WHERE starts_with(message, 'SELECT 1');
----
SELECT 1 as d