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.

Implementing custom column types

See original GitHub issue

Hello,

I just recently stumbled upon Piccolo and I’m very impressed so far with how much thought and effort has been put into it. Modern Python desperately needs an ORM that can keep up with the next generation of web development libraries. Piccolo looks to be well on it’s way to fill that need.

I have a project in mind that I could use Piccolo with, but it does have a use case that requires the use of a PostGIS geography type column. I’ve been looking through https://github.com/piccolo-orm/piccolo/blob/master/piccolo/columns/base.py and it doesn’t look too daunting to subclass Column and go from there. If I can get something useable, even with using raw for selects, it would be pretty great.

Since there doesn’t seem to be any documentation on implementing custom columns, I’d figure I’d post an issue, even if there isn’t really a problem yet just in case anyone had any advice or thoughts.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
dantownsendcommented, Feb 3, 2021

@Fingel I think those issues are all solvable, but will require some changes to Piccolo.

  1. Custom column types could be registered in piccolo_conf.py, which solves the migration issue.
  2. In terms of adding custom methods like ST_Dwithin, the best analogy so far is the JSONB column type, which has an arrow method. Something similar to this could be implemented.
  3. With raw SQL in where clauses - this also shouldn’t be too tricky, and I can add this.

I should be able to get 1 and 3 done in the next day or so. Otherwise you might want to fork it for now.

0reactions
dantownsendcommented, Sep 16, 2021

Going to close this for now - custom column types should now be possible.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Define Data Type While Creating Custom Column - BI Gorilla
Assigning data type to Custom Column · Go to Add Column -> Click Custom Column · Name the column DoubleNumbers -> fill in...
Read more >
Create a data type (Power Query) - Microsoft Support
In Power Query, create a custom data type: import, shape, and load it into an Excel Table. View it in a card, extract...
Read more >
Create a Custom Data Type - Salesforce Developers
To implement the custom type datatable, create a wrapper component to contain your extended datatable component, define the datatable's columns, and fetch data....
Read more >
Creating a Custom Data Type - Micro Focus
Creating a Custom Data Type. On the Tools menu, click Custom Data Types. The Custom Data Types tab is displayed. To define a...
Read more >
Custom column types - Jspreadsheet
Custom column type ​​ The following example shows how to integrate a third-party clock plugin as a custom column. From version 8, the...
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