Why MS SQL bigint type is implicitly mapped to float64 python type, and what is the best way to handle it?
I write down the best solution what I found:
CREATE TABLE #test (
    big_integer BIGINT
);

INSERT INTO #test 
    (big_integer)
VALUES
    (36028797018963968),
    (36028797018963968 + 1);

CREATE TABLE #out (
    big_integer BIGINT
);

INSERT INTO #out
    EXECUTE sp_execute_external_script 
        @language = N'Python',
        @input_data_1 = N'SELECT CAST(big_integer AS VARCHAR(20)) AS big_integer FROM #test',
        @script = N'
import numpy as np
print(InputDataSet)
InputDataSet[&quot;big_integer&quot;] = InputDataSet[&quot;big_integer&quot;].astype(np.int64)
InputDataSet[&quot;big_integer&quot;] = InputDataSet[&quot;big_integer&quot;] + 1
InputDataSet[&quot;big_integer&quot;] = InputDataSet[&quot;big_integer&quot;].astype(str)
OutputDataSet = InputDataSet
';

SELECT big_integer FROM #out;

I did what I supposed in the question:

cast the big_integer column to VARCHAR(20) the maximum length of a string representation of 64 bit signed integer:

In [34]: len(str(-2**63))
Out[34]: 20

In [35]: len(str(2**63-1))
Out[35]: 19


cast it back to numpy.int64 type in the external script.

made a simple calculation: incremented all values in the column

cast it back to string still in python. This step also necessary, because the implicit type conversion works both ways.

Inserted the values into the big_integer column of the #out table. Which also has a BIGINT type and the returned strings were implictly casted to BIGINT


Note
It would be a rare event where you need to handle this problem. The integer value must be bigger than 2^52 so a distance between two float64 will be greater than 1.
In [50]: def float_distance(x):
    ...:     x_float = float(x)
    ...:     x_next_float = np.nextafter(x_float, np.inf)
    ...:     x_float_diff = x_next_float - x_float
    ...:     return(x, x_float, x_next_float, x_float_diff)

In [51]: float_distance(2**52)
Out[51]: (4503599627370496, 4503599627370496.0, 4503599627370497.0, 1.0)

In [52]: float_distance(2**53)
Out[52]: (9007199254740992, 9007199254740992.0, 9007199254740994.0, 2.0)

I guess this may occur if your store the results of high throughput scientific research in physics or in bioinformatics.