Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table names are... partially case-sensitive #24

Open
pjpiwowarski opened this issue Feb 23, 2022 · 2 comments
Open

Table names are... partially case-sensitive #24

pjpiwowarski opened this issue Feb 23, 2022 · 2 comments

Comments

@pjpiwowarski
Copy link
Contributor

There's some fairly weird behavior when trying to access tables with non-lowercase names. For example (where ps() returns a PowerSchool() instance):

>>> ps().get_schema_table('GradeScaleItem').query()
[None, None, None, ... (one for each row in GradeScaleItem)]

This appears to be happening because, while PowerSchool smiles tolerantly and returns the results you'd expect, the keys in its response are still all lowercase, as in:

{
    'name': 'GradeScaleItem',
    'record': [
        {
            'id': 1, 
            'tables': {'gradescaleitem': { (record keys/values) }}
        },
        ...
    ]
}

As a result, the second get() call at client.py:243 fails to find a match and returns None (because self.name differs from the result's value in case):

data.append(r.get("tables").get(self.name))

Whether this should be "fixed" by case-smashing the table name (self.name.lower() or so) and/or the keys in the result, or just documented in the future (when there exists documentation), I don't know.

@cbini
Copy link
Member

cbini commented Feb 23, 2022

good catch!

have you also encountered this with other tables? also, have you encountered this in the opposite direction? (i.e. table.name is lowercase but record.tables.name is mixed case)

@pjpiwowarski
Copy link
Contributor Author

pjpiwowarski commented Feb 23, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants