Python Lambda Set Variable Sql Query