import struct


def get_query(sql):
    """
    https://dev.mysql.com/doc/internals/en/com-query.html
    1              [03] COM_QUERY
    string[EOF]    the query the server shall execute
    """
    query = b''
    query += struct.pack("<B", 3)
    query += sql.encode()

    query = struct.pack('<I', len(query))[:-1] + struct.pack('<B', 0) + query
    return query