Skip to content
This repository was archived by the owner on Nov 7, 2025. It is now read-only.

Commit 3efb239

Browse files
authored
Comments/docs on "bring your own table" and ALTER situation (#1484)
When users connect Quesma to ClickHouse and would like to work with tables which **are not created by Quesma**, `ALTER` statements doesn't work, unless `attributes_*` columns are present. Therefore we end up with: 1. No `ALTER` executed 2. Extra fields being ignored because we **neither** added the dedicated column **nor** had `attributes_*` column to store it. In general, we discourage such setup in read/write scenarios - it's always better to have Quesma manage your CH tables so that it controls any required metadata. In most cases BYOT is used in read-only, ingest-disabled situations. However, there's a simple way to mitigate this limitation: ``` ALTER TABLE test_db.test_table [ON cluster quesma_cluster] ADD COLUMN "attributes_values" Map(String, String) ALTER TABLE test_db.test_table [ON cluster quesma_cluster] ADD COLUMN "attributes_metadata" Map(String, String) ```
1 parent d953f9f commit 3efb239

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

platform/ingest/processor.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,8 @@ func (ip *SqlLowerer) GenerateIngestContent(table *database_common.Table,
633633
encodings map[schema.FieldEncodingKey]schema.EncodedFieldName) ([]AlterStatement, types.JSON, []NonSchemaField, error) {
634634

635635
if len(table.Config.Attributes) == 0 {
636+
// This implies that the table has no `attributes_*` columns, most likely it's a Bring Your Own Table (BYOT) situation, ref: https://github.com/QuesmaOrg/quesma/pull/1484
637+
logger.Error().Msg("received non-schema fields but no attributes config found. Extra fields will not be stored")
636638
return nil, data, nil, nil
637639
}
638640

0 commit comments

Comments
 (0)