1. Vladimir Esipov
  2. Valentina Studio
  3. Пятница, Сентябрь 06 2024, 06:17 AM
  4.  Подписаться через email
Let me ask a couple of questions.

1. At the moment, to set the configuration I need, I use a snippet, executing it when opening the DB.
Is it possible to implement something like this:
When opening the DB "DBNAME.DDB" check the folder for the presence of the initialization file "DBNAME.INI", containing configuration parameters that differ from the default or any queries that need to be executed at startup. For example:

SET memory_limit='16GB';
SET threads=4;
SET pivot_limit=100;
SET default_collation = nocase;
SET home_directory='E:\DUCK_DATA';
SET extension_directory='E:\DUCK_DATA\EXT';

If it exists, execute it when establishing a connection.
Is it possible to add the Properties panel selection to the list (as is done for VDB) and, when opening this tab, execute the query: FROM duckdb_settings(), displaying information in this panel.
And also, as is the case for VDB, make these parameters editable, saving the changes to the "DBNAME.INI" file.

2. When requested, the Studio returns an incomplete table creation script. This is especially problematic for tables that look at external data - csv, parquet, etc.
For example, I create a table:

CREATE TABLE JRN_TSV (
DTM TIMESTAMP NOT NULL,
ELP USMALLINT NOT NULL,
... any fields ...
PRF VARCHAR NOT NULL,
ANS BOOLEAN NOT NULL )
AS
SELECT * FROM read_csv('E:/DUCK_DATA/CSV/JRN.tsv', DELIM=' ', header=TRUE, QUOTE='', ESCAPE='', columns={'DTM': 'DATETIME', 'ELP': 'UINT16', ... any fields ... 'PRF': 'CHAR', 'ANS': 'BOOL'});

Later I ask PopUP->Generate Query->Create.. to show me the table creation script. I get a truncated result:

CREATE TABLE "main"."JRN_TSV" (
"DTM" Timestamp NOT NULL,
"ELP" USmallInt NOT NULL,
... any fields ...
"PRF" VarChar NOT NULL,
"ANS" Boolean NOT NULL );

SELECT sql FROM duckdb_tables() WHERE table_name='JRN_TSV';
gives the same result. DBeaver has similar behavior - it also returns a truncated DDL script.

But the table reads the data normally - does that mean this metadata is stored somewhere?
I couldn't find how to get to it.
A similar problem also concerns MySQL_Plugin, I gave an example in some ticket on MANTIS, but in the case of MySQL at least through SHOW you can get to the exact metadata.

By the way, I once again appreciated your idea with virtual links!
The DuckDB team recommends using PK, FK and indexes in general only in extreme cases when it is really necessary, and here your idea is very useful. It is convenient to view related records in the editor and see the relationships between tables.
Комментарий
There are no comments made yet.
Vladimir Esipov Ответ принят
Regarding point 2 - the question is removed.
The devil got me - I created a permanent table myself and uploaded the data to it.
So everything is correct! I apologize
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
Hello Vladimir,

1. Perhaps we could start by adding these parameters to the global preferences. Or do you need to change them frequently for different databases?

2. I believe that JRN_TSV doesn't depend on the initial CSV file. After removing or modifying the file, the data in the table doesn't change. Or am I missing something?
Комментарий
There are no comments made yet.
Vladimir Esipov Ответ принят
Sergey, hello!
About point 2 - you are absolutely right. I had VIEW in mind, but created TABLE. Probably, I didn't get enough sleep.
About point 1 - there are a lot of these settings. For version 1.0 there are 81 of them, for ver.1.1 - 102.
I would put in global engine settings only frequently used parameters, as well as those that are set at the time of DB creation, for example BLOCK_SIZE, and those that cannot be changed during the session - lock_configuration, access_mode, etc.
However, I am more interested not so much in the settings, but in the ability to execute a SQL-script at the time of connection, relevant for a specific DB.
Комментарий
There are no comments made yet.
Vladimir Esipov Ответ принят
Initializing the DB via a script after connecting - everything works as it should!
Special thanks for updating the DuckDB to version 1.1, and for cutting out the test generators and ICU from the DLL.
Excellent.:D
Комментарий
There are no comments made yet.
  • Страница :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Categories

Announcements & News
  1. 0 subcategories
Valentina Studio
  1. 2 subcategories
Valentina Server
  1. 4 subcategories
Valentina Database ADK
  1. 0 subcategories
Valentina Reports ADK
  1. 0 subcategories
Other Discussions
  1. 2 subcategories
BETA Testing
  1. 0 subcategories
Education & Research
  1. 0 subcategories