Issues with printing bytea data from PostgreSQL in python, but always get <memory at 0x> address

Viewed 115

So I am having some troubles getting access the bytea binary data from PostgreSQL using Python. So this is the model for Images:

class Images(models.Model):
    image_code = models.BinaryField()
    caption = models.CharField(max_length=100,default='IMG_CAPTION')

Here is the data table from PostgreSQL

id image_code (bytea) caption (char var)
1 [binary] DEFAULT CAPTION

So in my project I have following

store_length = len(Images.objects.all())
image_shown = Images.objects.all()[store_length-1]
code_string = image_shown.image_code
print(code_string.image_code)

The output I get is memory address <memory at 0x7ff5ae03a888>. The output is supposed to be string.

What should I do here?

1 Answers
Related