kennethreitz / records

SQL for Humans™
https://pypi.python.org/pypi/records/
ISC License
7.16k stars 572 forks source link

pip version does not contain .first() method #96

Closed landergate closed 6 years ago

landergate commented 7 years ago

Hey there, It looks like .first() method is not yet exist in 0.5.0 release.

No big deal, but kinda misleading, as it was mentioned on README.

AlJohri commented 7 years ago

@kennethreitz can you release a new version please?

pjz commented 7 years ago

I'm currently monkeypatching until next release:

import records

def rc_first(self, default=None):                                                                                                                                
    # Try to get a record, or return default.                                                                                                                    
    try:                                                                                                                                                         
        return self[0]                                                                                                                                           
    except IndexError:                                                                                                                                           
        return default                                                                                                                                           

records.RecordCollection.first = rc_first     
ni-tterry commented 7 years ago

records 0.5.2 is now on pypi, and supports the .first() method.

kennethreitz commented 7 years ago

thanks @eightyeighteyes!

kennethreitz commented 7 years ago

hard to keep up with all these libraries :)

kennethreitz commented 7 years ago

If anyone wants to help with records releases, let me know.

ni-tterry commented 7 years ago

Thank YOU @kennethreitz ... as someone testing a database migration from mssql to postgres, I really appreciate your work here. records has proved to be invaluable.

kennethreitz commented 7 years ago

@eightyeighteyes that's wonderful news!

kennethreitz commented 7 years ago

Curious, are you using the bulk loader?

kennethreitz commented 7 years ago

I don't understand how it works very well, but it's intended for such use cases, from what I understand.

ni-tterry commented 7 years ago

Not yet, just noticed it. I'm in the thick of things right now so no time to change anything, but when I refactor my tests, I'll give it a whirl. I could definitely see how it would be useful for creating a test database before application tests run.

vlcinsky commented 6 years ago

As @eightyeighteyes noted in his comment, first is already available since 0.5.2