-
Notifications
You must be signed in to change notification settings - Fork 126
Description
Hey!
First of all, Please excuse my shallow knowledge if I miss something or considered noobe.
I am exploring both Go and ScyllaDB. I run a cluster of 3 node of scylladb/scylla:2025.4 in docker.
I have a user table and want to insert a unique record by email.
This is how I did it
func insertUniqueByEmail(ctx context.Context, session gocqlx.Session, user models.UsersStruct) (models.UsersStruct, error) {
now := time.Now().UTC()
if user.UserId == (gocql.UUID{}) {
user.UserId = gocql.TimeUUID()
}
if user.CreatedAt.IsZero() {
user.CreatedAt = now
}
user.UpdatedAt = now
var existingEmail string
var existingUserId gocql.UUID
stmt, names := models.UsersByEmail.InsertBuilder().Unique().ToCql()
applied, err := session.Query(stmt, names).WithContext(ctx).BindStruct(user).ScanCAS(&existingEmail, &existingUserId)
if err != nil {
return models.UsersStruct{}, fmt.Errorf("Failed to execute unique insert: %w", err)
}
if !applied {
return models.UsersStruct{}, errors.New("Email already exists!")
}
iq := models.Users.InsertQuery(session).WithContext(ctx).BindStruct(user)
if err := iq.Exec(); err != nil {
dq := models.UsersByEmail.DeleteQuery(session).WithContext(ctx).BindStruct(user)
_ = dq.Exec()
return models.UsersStruct{}, fmt.Errorf("User insertion failed: %w", err)
}
return user, nil
}It works fine. however, from what I understand, ScyllaDB create internal table for LWT user_by_email$paxos
Now the issue is when I do changes in Table schema and re-generate the code, it fails with
$ 2026/01/31 22:27:29 failed to generate schema: render template: template: template: keyspace.tmpl:16:26: executing "keyspace.tmpl" at <camelize>: error calling camelize: not allowed name users_by_email$paxos
make: *** [makefile:19: code-gen] Error 1From what I saw, that there is a method called camelize here https://github.com/scylladb/gocqlx/pull/201/changes#diff-f02315fd0ffeeb72b434f832ff541eddaad1f74f859bbec1c5910ba6399aa4f3 that caused this issue.
Is that considered a bug or do I miss something ?
If I may to suggest that we have a flag to ignore tables. Something like
-ignoreTables="user_by_email$paxos"or we detect the name "$paxos" and exclude it from the generation.
For sure you know better in regard.