Re: python question

By ORM I ment Object-relational mapping.

With other words, I want to be able to access a MySQL, Oracle, PostgreSQL or even SQLite database with objects, without needing to write SQL code at all.

I think it would be more simple to do something like:

db = TheORMName.connect("mysql", "databaseName", "user", "password")

recordset = db.table("testTable").search(id=123)

print(recordset.first.age)

recordset.update(name="My Name", age=55)

or putting the name of the dictionary in place of those fields, than composing an SQL query based on different conditions.

I hope to find an ORM that can work with primary keys made of multiple columns, that can do table joins and allow using operators like "like" and other simple features like these...

Octavian

----- Original Message ----- From: "Ken Perry" <whistler@xxxxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Saturday, December 20, 2008 3:36 AM
Subject: RE: python question


Well since ORM has all these following meanings
ORM is an acronym for:

Object role modeling
Object-relational mapping
Operational Risk Management a U.S. Navy concept for safety in operations
planning
Online research methods
Orosomucoid
Outsourcing Relationship Management
Online Reputation Management

ORM is also:

the IATA airport code for Sywell Aerodrome in Northamptonshire, England


I am not sure exactly what you want. I mean you mentioned a lot of database
mapping libraries so I am hoping that is what you are looking for.  We use
sqlite3 for our db only because it has some easy ways to just request whole
tables into dictionaries in python.  I am not sure if you would consider
doing sql requests and having it auto port it into a dictionary an ORM but
to each their own.

Ken
-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Octavian Rasnita
Sent: Friday, December 19, 2008 5:01 PM
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: python question

Hmm, is there an ORM for python that has the same name as the SQLite command

line client?

Octavian

----- Original Message ----- From: "Ken Perry" <whistler@xxxxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Friday, December 19, 2008 10:58 PM
Subject: RE: python question



We use sqlite3

Ken

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Jim Dunleavy
Sent: Friday, December 19, 2008 4:59 AM
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: python question

Hi,

SQLAlchemy seems to have the most features.
It's the default ORM for the TurboGears framework.

--Jim

----- Original Message -----
From: Octavian Rasnita <orasnita@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Thursday, December 18, 2008 11:50 AM
Subject: Re: python question


Ok, thanks.

Even though it requires a few more keywords, at least it doesn't require
quoting the keys of the dictionary.

I am searching for information about a good ORM in python, but what I
found
so far wasn't too impressive.
Does anyone know a really good ORM in python like DBIx::Class or
Rose::DB::Object in perl?

I found that for python there are more ORMS like: SQLObject, Axiom,
Bazaar
ORM, DbObj, Dejavu, forgetSQL, MiddleKit, Modeling Object-Relational
Bridge,
Object Relational Membrame, PyDo, SQLAlchemy, Storm... which of them do
you
think it is the best?

Thanks.

Octavian

----- Original Message -----
From: "Jamal Mazrui" <empower@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Thursday, December 18, 2008 12:45 AM
Subject: Re: python question


> Here is a Python 3 version.
> Jamal
>
> d = dict(John = 40, Michael = 40, Joe = 30)
> l = sorted(d.keys(), reverse = True)
> l = sorted(l, key = lambda k: d[k])
> for k in l: print(k + ', ' + str(d[k]))
>
>
> On Wed, 17 Dec 2008, Octavian
> Rasnita wrote:
>
>> Date: Wed, 17 Dec 2008 22:52:20 +0200
>> From: Octavian Rasnita <orasnita@xxxxxxxxx>
>> Reply-To: programmingblind@xxxxxxxxxxxxx
>> To: programmingblind@xxxxxxxxxxxxx
>> Subject: Re: python question
>>
>> Thank you for your answer, but I couldn't run it with python 3.
>>
>> I have re-formatted the print statement which in python 3 is a
function,
>> but
>> I don't know how to solve the other error that appeared.
>>
>> The code is:
>>
>> hash = {'John': 40, 'Michael': 40, 'Joe': 30}
>> keys = sorted(hash.keys(), reverse = True)
>> keys = sorted(keys, lambda x, y: cmp(hash[x], hash[y]))
>> for key in keys: print(key + ', ' + str(hash[key]))
>>
>> And the error is:
>>
>> Traceback (most recent call last):
>> File "srt.py", line 3, in <module>
>> keys = sorted(keys, lambda x, y: cmp(hash[x], hash[y]))
>> TypeError: must use keyword argument for key function
>>
>> Thanks.
>>
>> Octavian
>>
>> ----- Original Message -----
>> From: "Jamal Mazrui" <empower@xxxxxxxxx>
>> To: <programmingblind@xxxxxxxxxxxxx>
>> Sent: Wednesday, December 17, 2008 10:18 PM
>> Subject: RE: python question
>>
>>
>> > I'm not an advanced Python user, so there may be more efficient or
>> > elegant
>> > solutions.  The code below is a Python 2.5 equivalent.
>> >
>> > Jamal
>> >
>> > hash = {'John': 40, 'Michael': 40, 'Joe': 30}
>> > keys = sorted(hash.keys(), reverse = True)
>> > keys = sorted(keys, lambda x, y: cmp(hash[x], hash[y]))
>> > for key in keys: print key + ', ' + str(hash[key])
>> >
>> > -----Original Message-----
>> > From: programmingblind-bounce@xxxxxxxxxxxxx
>> > [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of >> > Octavian
>> > Rasnita
>> > Sent: Wednesday, December 17, 2008 8:40 AM
>> > To: programmingblind@xxxxxxxxxxxxx
>> > Subject: Re: python question
>> >
>> > The Windows msi installer for python from python.org contains a chm
>> > help
>> > file for python 3, or at least this is how it is named.
>> >
>> > I haven't started to read it though.
>> >
>> > But I have a question regarding python.
>> >
>> > I have started to read the book "Perl to python migration" hoping >> > to
>> > understand it better, but I am pretty confused of how python does
>> > the
>> > sorting, or at least about how it is explained in that book that
might
>> > be
>> > old, because it talks about python 2.0.
>> >
>> > For example, if I have a perl hash, or python dictionary like:
>> >
>> > my %hash = (Joe => 30, John => 40, Michael => 40);
>> >
>> > and I want to sort it for example by the values of the hashin
>> > increasing
>> > order, then by the keys of the hash in decreasing order, in perl I
>> > would
>> > need to do just:
>> >
>> > foreach my $key(sort {$hash{$a} <=> $hash{$b} or $b cmp $a} keys
%hash)
>> > {
>> > print "$key, $hash{$key}\n"; }
>> >
>> > This would print:
>> > Joe, 30
>> > Michael, 40
>> > John, 40
>> >
>> > Can you tell me how to do this in python? I hope there are newer
>> > ways
>> > of
>> > doing this more easier than what I read in that book.
>> >
>> > And I would also like to know which is the prefered ORM, the
>> > prefered
>> > templating systems, form manager(s), web framework... (although I
think
>> > it
>> > is Zope), so if you have used them, please tell me.
>> >
>> > Octavian
>> >
>> > ----- Original Message -----
>> > From: <james.homme@xxxxxxxxxxxx>
>> > To: <programmingblind@xxxxxxxxxxxxx>
>> > Sent: Wednesday, December 17, 2008 2:29 PM
>> > Subject: RE: python question
>> >
>> >
>> >> Hi,
>> >> Along those lines, does anyone know if any of the Python
documentation
>> > on
>> >> http://www.nonvisualdevelopment.org talks about 3.0?
>> >>
>> >> Thanks.
>> >>
>> >> Jim
>> >>
>> >> James D Homme, Usability Engineering, Highmark Inc.,
>> >> james.homme@xxxxxxxxxxxx, 412-544-1810
>> >>
>> >> "The difference between those who get what they wish for and those
who
>> >> don't is action. Therefore, every action you take is a complete
>> >> success,regardless of the results." -- Jerrold Mundis
>> >> Highmark internal only: For usability and accessibility:
>> >> http://highwire.highmark.com/sites/iwov/hwt093/
>> >
>> > __________
>> > View the list's information and change your settings at
>> > http://www.freelists.org/list/programmingblind
>> >
>> >
>> > __________
>> > View the list's information and change your settings at
>> > http://www.freelists.org/list/programmingblind
>> >
>>
>> __________
>> View the list's information and change your settings at
>> http://www.freelists.org/list/programmingblind
>>
> __________
> View the list's information and change your settings at
> http://www.freelists.org/list/programmingblind
>

__________
View the list's information and change your settings at
http://www.freelists.org/list/programmingblind



----------------------------------------------------------------------------
"Information in this email (including attachments) is confidential.
It is intended for receipt and consideration only by the intended
recipient.
If you are not an addressee or intended recipient, any use, dissemination,
distribution, disclosure, publication or copying of information contained
in
this email is strictly prohibited.  Opinions expressed in this email may
be
personal to the author and are not necessarily the opinions of the HSE.

If this email has been received by you in error we would be grateful if
you
could immediately notify the ICT Service Desk by telephone at +353 1
6352757

or by email to service.desk@xxxxxxxxxxxx and thereafter delete this
e-mail from your system"

----------------------------------------------------------------------------
__________
View the list's information and change your settings at
http://www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at
http://www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at
http://www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at
http://www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at http://www.freelists.org/list/programmingblind

Other related posts: