Unable to update the data
func (repo JourneyRepo) UpdateJourneyByID(c context.Context, journey models.Journey) (*models.Journey, error) { // API tracing enabling if span := tracing.TraceSpan(c, "journeyRepo.UpdateJourneyByID"); span != nil { defer span.End() }
session := repo.GetScyllaDBConnection()
// Start building the update query
updStmt := qb.Update("journeys").
Set("name", "status", "segment_id", "tags", "flow_json", "updated_by", "updated_at").
Where(qb.Eq("id"), qb.Eq("client_ref_number"))
// Convert to CQL statement
update, names := updStmt.ToCql()
// Create a map for the bind parameters
bindMap := qb.M{
"id": journey.ID,
"client_ref_number": journey.ClientRefNumber,
"name": journey.Name,
"status": journey.Status,
"segment_id": journey.SegmentId,
"tags": journey.Tags,
"flow_json": journey.FlowJSON,
"updated_by": journey.UpdatedBy,
"updated_at": journey.UpdatedAt,
}
// Execute the update query
if err := gocqlx.Query(session.Query(update), names).BindMap(bindMap).ExecRelease(); err != nil {
return nil, err
}
// Return the updated journey
return &journey, nil
}. A error is coming "Cannot execute this query as it might involve data filtering and thus may have unpredictable performance. If you want to execute this query despite the performance unpredictability, use ALLOW FILTERING". Unable to call AllowFiltering(). function.
Please reformat your issue description, it seems to be broken and provide steps to reproduce your issue
func (repo JourneyRepo) UpdateJourneyByID(c context.Context, journey models.Journey) (*models.Journey, error) { // API tracing enabling if span := tracing.TraceSpan(c, "journeyRepo.UpdateJourneyByID"); span != nil { defer span.End() } session := repo.GetScyllaDBConnection() // Start building the update query updStmt := qb.Update("journeys"). Set("name", "status", "segment_id", "tags", "flow_json", "updated_by", "updated_at"). Where(qb.Eq("id"), qb.Eq("client_ref_number")) // Convert to CQL statement update, names := updStmt.ToCql() // Create a map for the bind parameters bindMap := qb.M{ "id": journey.ID, "client_ref_number": journey.ClientRefNumber, "name": journey.Name, "status": journey.Status, "segment_id": journey.SegmentId, "tags": journey.Tags, "flow_json": journey.FlowJSON, "updated_by": journey.UpdatedBy, "updated_at": journey.UpdatedAt, } // Execute the update query if err := gocqlx.Query(session.Query(update), names).BindMap(bindMap).ExecRelease(); err != nil { return nil, err } // Return the updated journey return &journey, nil }A error is coming "Cannot execute this query as it might involve data filtering and thus may have unpredictable performance. If you want to execute this query despite the performance unpredictability, use ALLOW FILTERING". Unable to call AllowFiltering(). function.
Just let you know that mostly it is because of problem on data layout.
But to make it happen you can add ALLOW FILTERING to the end of the query:
// Execute the update query
if err := gocqlx.Query(session.Query(update + ` ALLOW FILTERING`), names).BindMap(bindMap).ExecRelease(); err != nil {
return nil, err
}
But you are correct we should add this feature.
Question is answered, for add allow filtering api I have created separate issue.
Thanks Scylladb/Gocqlx team for the solution. My team members are struggling to work with Gocqlx package. Because documentation codes are outdated. Please update everything in the documentation. It will helpfull for everyone.
Thanks & Regards, Arun Kumar K
On Fri, 6 Sep 2024 at 6:28 PM, Dmitry Kropachev @.***> wrote:
Question is answered, for add allow filtering api I have created separate issue https://github.com/scylladb/gocqlx/issues/288.
— Reply to this email directly, view it on GitHub https://github.com/scylladb/gocqlx/issues/280#issuecomment-2333996580, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATZPJAVSZU4LCG6VPXWXRZTZVGRI3AVCNFSM6AAAAABKWYUAS6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZTHE4TMNJYGA . You are receiving this because you authored the thread.Message ID: @.***>
@Arunkumar-hockey , thanks, documentation issues will be addressed here, please feel free to add more information.