Closed tomaszpochron closed 9 months ago
Hi Tomasz @tomaszpochron, thanks so much for trying out the Climate Mind backend API. Your question is a good one. We use T-SQL (transact SQL) for our backend SQL server and database. SQL Queries that search the TSQL databases for matches in a table will ignore trailing spaces. This is a behavior that is built into the TSQL server and SQL dialect.
Another separate thing to mention just to keep in mind is that we use SQL Alchemy as an intermediary. The SQL alchemy package acts as a bridge, allowing us to use python code to conduct SQL database interactions. This is why you will rarely see SQL code in our code base and why it’s harder to realize that the inconsistency you pointed out is a feature of SQL.
I believe this answers your question. Let us know! And if not let us know and we will do our best to help out. You can read more about this too at the following links:
https://m.youtube.com/watch?v=kf7yop2ik3M
https://bertwagner.com/posts/trailing-spaces-in-sql-server/
https://www.brentozar.com/archive/2017/04/surprising-behavior-trailing-spaces/
Cheers, Kameron
On Sun, Jan 7, 2024 at 4:15 PM Tomasz Pochroń @.***> wrote:
External Email
Hi,
My name is Tomasz Pochron, and I am a student at Jagiellonian University. I'm writing to report a discrepancy observed in email address validation within our project.
During a practical exercise in our software development class, we noticed that when testing our API through Postman, it accepts email addresses with trailing spaces. However, this is not the case with our application's user interface, which correctly rejects such inputs. This inconsistency was also observed during routine quality assurance testing.
Here is a screenshot illustrating the issue: Zrzut.ekranu.2024-01-06.221022.png (view on web) https://github.com/ClimateMind/climatemind-backend/assets/23237107/8fc84f42-e6ce-4640-93c8-5c58daa2a772
We are keen to understand the reason behind this discrepancy and would greatly appreciate any insights or advice you could offer. This will not only help us resolve the current issue but also enhance our overall understanding of API development and testing.
Thank you for your time and assistance.
Best regards, Tomasz Pochron
— Reply to this email directly, view it on GitHub https://github.com/ClimateMind/climatemind-backend/issues/507, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEXL62VL76TIKTHHXPB5EETYNM3BNAVCNFSM6AAAAABBQV527GVHI2DSMVQWIX3LMV43ASLTON2WKOZSGA3DSMZWHEZTQMQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
@tomaszpochron I believe this behavior of ignoring trailing spaces is controlled by the ANSI_PADDING setting for the SQL server. By default is is set to ON. Turing it to OFF might resolve the inconsistency you brought up, but it creates other problems with the database so it’s recommended to keep it set to ON. https://learn.microsoft.com/en-US/sql/t-sql/statements/set-ansi-padding-transact-sql?view=sql-server-ver16
Hi Kameron (@rodriguesk),
Thank you so much for the detailed response regarding the trailing spaces issue in the Climate Mind backend API. Your explanation regarding the behavior of T-SQL and its interaction with SQL Alchemy provided a clear understanding of the issue. I appreciate the time and effort you took to address our query.
Best regards, Tomasz Pochron
Hi,
My name is Tomasz Pochron, and I am a student at Jagiellonian University. I'm writing to report a discrepancy observed in email address validation within our project.
During a practical exercise in our software development class, we noticed that when testing our API through Postman, it accepts email addresses with trailing spaces. However, this is not the case with our application's user interface, which correctly rejects such inputs. This inconsistency was also observed during routine quality assurance testing.
Here is a screenshot illustrating the issue:
We are keen to understand the reason behind this discrepancy and would greatly appreciate any insights or advice you could offer. This will not only help us resolve the current issue but also enhance our overall understanding of API development and testing.
Thank you for your time and assistance.
Best regards, Tomasz Pochron