What are the challenges you face when working across database platforms? Take the survey

Why am I getting the "Not enough rows for column" error

I have the following IronPython script:

def main(config):
    if licence_period == "1" or licence_period == "2":
        return "New Licence"
        return ["Renewal","New Licence"]

I am in the Licence_type column referencing the field licence_period.  When I used the above I get the error "Not enough rows for column" but if I just used:

def main(config):
    if licence_period == "90 Days" or licence_period == "24 Hours":
        return "New Licence"
        return "Renewal"

I get the 1000 rows I want.




  • Options
    Jessica RJessica R Posts: 1,319 Rose Gold 4
    Hi @shawn_collymore!

    Sorry to say that we're not Python experts ourselves, however, if I'm reading this correctly: it looks like the first script is returning an array of two values in the else statement, so it's trying to populate two columns worth of values into one column.

    The bottom one is returning one value for one column which is why it works. You'll need to ensure that the script only returns one value- perhaps doing something in the else statement that determines which to return and return that one value?

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?

Sign In or Register to comment.