Skip to content

FR: Aliasing/remapping field names to avoid collisions with keywords/reserved builtins in programming languages. #20

@redtrinity

Description

@redtrinity

Various programming languages such as Python have reserved keywords/builtins that collide with some of the TASS database table column names; for example, class is a reserved keyword that is used to create classes.

As an example of this, there are a number of tables in TASS that uses class as a column name (such as studsub and tchsub), if this column name was to be used in current or future endpoints, it could cause issues.

It would be helpful from an end use perspective if the property names in the API's for these column names gets mapped to something else; for example class could become class_code.

Using Python as an example language, the following column names in tables (views excluded) have been found that will collide with an equivalent keyword/builtin if an API endpoint refers to data from that table.

COLUMN_NAME TABLE_NAME
class assesstasks
class blockalloc
class bookbundle
class cal_sub_assign
class custom_roll_class
class ek_activity_assign
class ek_blog
class ek_class_topic
class ek_fbof_forum
class ek_resource_class
class email_log_subcls
class liss_classes
class ls_class_plan
class plstudsub
class rollsubmit
class ruleuse
class studconduct
class studsub
class studttmast
class subclstlate
class suboverview
class syscolumnext
class tchfill
class tchleaveperiod
class tchleaveperiodaudit
class tchsub
class tkwh_1
class tkwh_10
class tkwh_12
class tkwh_2
class tkwh_3
class tkwh_4
class tkwh_7
class tkwh_8
class tkwh_9
class ttintmast
class ttmast
class ttmast_daily
class ttmast_delta
class ttmast_delta_audit
class wbconfig
filter custom_roll_stud
filter portalparms
type dataupdateaudit
type datauploadaudit
type liss_classes
type req_log
type tel_back
type tel_leavelog
type tel_oltslog

Source query:

USE TASS;
SELECT DISTINCT COLUMN_NAME, TABLE_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_CATALOG = 'TASS'
  AND TABLE_NAME NOT IN (
    SELECT TABLE_NAME FROM INFORMATION_SCHEMA.VIEWS
  )
  AND COLUMN_NAME IN (
    'False', 'None', 'True', 'and', 'as', 'assert', 'async', 'await', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda',
    'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield',
    'ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException', 'BaseExceptionGroup', 'BlockingIOError', 'BrokenPipeError', 'BufferError', 'BytesWarning', 'ChildProcessError', 'ConnectionAbortedError',
    'ConnectionError', 'ConnectionRefusedError', 'ConnectionResetError', 'DeprecationWarning', 'EOFError', 'Ellipsis', 'EncodingWarning', 'EnvironmentError', 'Exception', 'ExceptionGroup', 'False', 'FileExistsError',
    'FileNotFoundError', 'FloatingPointError', 'FutureWarning', 'GeneratorExit', 'IOError', 'ImportError', 'ImportWarning', 'IndentationError', 'IndexError', 'InterruptedError', 'IsADirectoryError', 'KeyError',
    'KeyboardInterrupt', 'LookupError', 'MemoryError', 'ModuleNotFoundError', 'NameError', 'None', 'NotADirectoryError', 'NotImplemented', 'NotImplementedError', 'OSError', 'OverflowError', 'PendingDeprecationWarning',
    'PermissionError', 'ProcessLookupError', 'RecursionError', 'ReferenceError', 'ResourceWarning', 'RuntimeError', 'RuntimeWarning', 'StopAsyncIteration', 'StopIteration', 'SyntaxError', 'SyntaxWarning', 'SystemError',
    'SystemExit', 'TabError', 'TimeoutError', 'True', 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError', 'UnicodeEncodeError', 'UnicodeError', 'UnicodeTranslateError', 'UnicodeWarning', 'UserWarning', 'ValueError',
    'Warning', 'ZeroDivisionError', '_', '__build_class__', '__debug__', '__doc__', '__import__', '__loader__', '__name__', '__package__', '__spec__', 'abs', 'aiter', 'all', 'anext', 'any', 'ascii', 'bin', 'bool',
    'breakpoint', 'bytearray', 'bytes', 'callable', 'chr', 'classmethod', 'compile', 'complex', 'copyright', 'credits', 'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'exec', 'exit', 'filter', 'float',
    'format', 'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', 'id', 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len', 'license', 'list', 'locals', 'map', 'max', 'memoryview', 'min',
    'next', 'object', 'oct', 'open', 'ord', 'pow', 'print', 'property', 'quit', 'range', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'vars', 'zip'
  )
ORDER BY COLUMN_NAME

The keywords and builtins list taken from Python 3.12.8.

import keyword, builtins
keyword.kwlist
dir(builtins)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions