[PonyORM-list] show() not printing LongStr (Alexey Malashkevich)

Chris Wood c.c.wood at gmail.com
Wed Dec 10 19:56:58 UTC 2014


Hi Alexey,

thanks for the reply; I should have been clearer about when I was
calling show()! I was trying to call it to show what data was in a
table in my database:

>>> from pony.orm import *
>>> db = Database()
>>> class Entity1(db.Entity):
...   attr1 = Required(LongStr)
...
>>> db.bind('sqlite',':memory:')
>>> db.generate_mapping(create_tables=True)
>>> show(E1)
class E1(Entity1):
    id = PrimaryKey(int, auto=True)
    attr1 = Required(LongStr)
>>> test_data_entry = Entity1(attr1="test!")
>>> data = select(p for p in Entity1)[:]
>>> data.show()
id
--
1

compared with

>>> from pony.orm import *
>>> db = Database()
>>> class Entity2(db.Entity):
...   attr2 = Required(str)
...
>>> db.bind('sqlite',':memory:')
>>> db.generate_mapping(create_tables=True)
>>> show(Entity2)
class Entity2(Entity):
    id = PrimaryKey(int, auto=True)
    attr1 = Required(str)
>>> test_data_entry= Entity2(attr2="test!")
>>> data = select(p for p in Entity2)[:]
>>> data.show()
id|attr2
--+-----
1 |test!


It seems that the column which is defined as a LongStr isn't
displayed, but one that is displayed as a str is?

Chris


On 10 December 2014 at 12:00,  <ponyorm-list-request at ponyorm.com> wrote:
> Send ponyorm-list mailing list submissions to
>         ponyorm-list at ponyorm.com
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         /ponyorm-list
> or, via email, send a message with subject or body 'help' to
>         ponyorm-list-request at ponyorm.com
>
> You can reach the person managing the list at
>         ponyorm-list-owner at ponyorm.com
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of ponyorm-list digest..."
>
>
> Today's Topics:
>
>    1. show() not printing LongStr (Chris Wood)
>    2. Example with disconnect() (Goldberg, Arthur P)
>    3. Re: show() not printing LongStr (Alexey Malashkevich)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 9 Dec 2014 14:44:41 +0000
> From: Chris Wood <c.c.wood at gmail.com>
> To: ponyorm-list at ponyorm.com
> Subject: [PonyORM-list] show() not printing LongStr
> Message-ID:
>         <CAMWh0wtRrOuygQcvrrw5-PFT4Bg5Cx9J564a5nKzp1S5twxoZg at mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8
>
> Hello all,
>
> I've discovered that if I set an attribute to have a type of LongStr,
> then calling show() on an entity of that class won't show that
> attribute - I couldn't find this documented anywhere; is it a known
> feature?
>
> Cheers,
> Chris
>
>
> ------------------------------
>
> Message: 2
> Date: Wed, 10 Dec 2014 02:39:03 +0000
> From: "Goldberg, Arthur P" <arthur.p.goldberg at mssm.edu>
> To: Pony Object-Relational Mapper mailing list
>         <ponyorm-list at ponyorm.com>
> Subject: [PonyORM-list] Example with disconnect()
> Message-ID: <944829BA-99BD-45AD-81CD-9165A7E5F260 at mssm.edu>
> Content-Type: text/plain; charset="utf-8"
>
> Hi Guys
>
> Could you please show an example with disconnect()? I'm using a couple of dbmses in one SQL server, and getting
> Database object was already bound to MySQL provider
> Sorry, I'm too rushed to debug carefully.
>
> Yhanks
> A
>
>
> ---
>
> Arthur Goldberg
> Associate Professor of Psychiatry
> Seaver Autism Center and Icahn Institute for Genomics & Multiscale Biology
> Icahn School of Medicine at Mount Sinai
> Seaver Center, Room ABE-33
> 212-241-4229
> Arthur.Goldberg at mssm.edu<mailto:Arthur.Goldberg at mssm.edu>
> Follow us on Twitter @IcahnInstitute<https://twitter.com/IcahnInstitute>
>
>
>
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: </ponyorm-list/attachments/20141210/5a1bddf5/attachment-0001.html>
>
> ------------------------------
>
> Message: 3
> Date: Wed, 10 Dec 2014 13:31:00 +0400
> From: Alexey Malashkevich <alexeymalashkevich at gmail.com>
> To: Pony Object-Relational Mapper mailing list
>         <ponyorm-list at ponyorm.com>
> Subject: Re: [PonyORM-list] show() not printing LongStr
> Message-ID:
>         <CABuFHj7VuShC-ekoCXLPQp-wo6jYZ1WKXW6n-U3n4jSGf+nJqQ at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hi Chris,
>
> I just tried the following example:
>
>
> from pony.orm import *
>
> db = Database()
>
> class Entity1(db.Entity):
>     attr1 = Required(LongStr)
>
> db.bind('sqlite', ':memory:')
> db.generate_mapping(create_tables=True)
>
> show(Entity1)
>
>
> And below is the output which I get:
>
>
> class Entity1(Entity):
>     id = PrimaryKey(int, auto=True)
>     attr1 = Required(LongStr)
>
> attr1 has type LongStr and it is displayed when I call show() for the
> Entity1. Could you provide your code snippet where it doesn't?
>
>
> Regards,
> Alexey
>
> On Tue, Dec 9, 2014 at 5:44 PM, Chris Wood <c.c.wood at gmail.com> wrote:
>
>> Hello all,
>>
>> I've discovered that if I set an attribute to have a type of LongStr,
>> then calling show() on an entity of that class won't show that
>> attribute - I couldn't find this documented anywhere; is it a known
>> feature?
>>
>> Cheers,
>> Chris
>> _______________________________________________
>> ponyorm-list mailing list
>> ponyorm-list at ponyorm.com
>> /ponyorm-list
>>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: </ponyorm-list/attachments/20141210/ee4a6683/attachment-0001.html>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> ponyorm-list mailing list
> ponyorm-list at ponyorm.com
> /ponyorm-list
>
>
> ------------------------------
>
> End of ponyorm-list Digest, Vol 16, Issue 4
> *******************************************


More information about the ponyorm-list mailing list