question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Natively support PGARRAY from PostgreSQL within the ORM

See original GitHub issue

Is your feature request related to a problem? Please describe. The request is not related to a problem and it is about a new feature, namely, I would like to be able to do exact matching of elements in a column in a database with a provided list of values natively by the means of PGARRAY data type, PostgreSQL built-in.

Describe the solution you’d like Possible usage is mentioned in the fixed issue: using __icontains for string matching returns partial string matches. However, fo my use case, I need exact matches. Thus, I would like, instead of implicitly converting JSONB to VARCHAR, to be able to have my data in the PGARRAY data type, so that if I have two rows with ["book", "new book", "interesting bookstore", "interesting book"] and ["new book", "interesting bookstore", "interesting book"] values in the Phrases column respectively, to search for matches with "book" and only get the first row, since it contains this element.

Describe alternatives you’ve considered A solution (and a manual alternative) would be to create a new field type in a similar fashion as here for the JSONB field: https://github.com/tortoise/tortoise-orm/blob/bad27105b07f85e9ea2213be3e451024a08a12dd/tortoise/fields/data.py#L371 After that a new filter is needed, that could also be created similarly to https://github.com/tortoise/tortoise-orm/blob/a3d8507fa529c89bc9f09dfcce16af2877e0d2a3/tortoise/filters.py#L150

Additional context The feature would bring more value to the ORM when it comes to the exact matching of elements with a database.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
grigicommented, Jun 2, 2020

Sorry, no. Since the whole covid-19 thing I have extremely limited time. I’m still around and healthy, but don’t see much time becoming available for the next few weeks. if anybody wants to have a go at this feature, you’re welcome.

1reaction
grigicommented, May 5, 2020

Hi @odimko No, sorry no updates. I don’t have much time this week to do anything much.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Class PgArray - PostgreSQL JDBC Driver
Array is used collect one column of query result data. Read a field of type Array into either a natively-typed Java array object...
Read more >
PgArray (PostgreSQL JDBC Driver - JDBC 4.2 42.2.6 API)
Retrieves the contents of the SQL ARRAY value designated by this Array object in the form of an array in the Java programming...
Read more >
postgresql-native/PgArray.java at master - GitHub
Native D language connector for PostgreSQL driver - conversion from JDBC connector - postgresql-native/PgArray.java at master · buggins/postgresql-native.
Read more >
How to map a PostgreSQL array with Hibernate - Stack Overflow
Hibernate does not support database arrays (e.g. ones mapped to java.sql.Array ) out of the box. array and primitive-array types provided by ...
Read more >
Active Record and PostgreSQL - Ruby on Rails Guides
Older versions are not supported. To get started with PostgreSQL have a look at the configuring Rails guide. It describes how to properly...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found