You are using the table alias
T twice. Try
QUERY="SET @row_number = 0; select * from (SELECT (@row_number:=@row_number + 1) AS '#input', t.* from view t LIMIT 100) as X;"
That was a glitch at my end.
As you have multiple statements in QUERY try
Beware: this can have different behaviour depending on which drivers you are using, so it's not the recommended approach.
If you have MySQL V8.0 or better then you could use the ROW_NUMBER
] function to get the same result
ROW_NUMBER() OVER () AS rn, ID from view;