jamalex / jamalex/notion-py

Sorting columns / Schema types

Open
#265 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
4.4k
Forks
470
PR merge metrics
No merged PRs in 30d

Description

Thanks for sharing your AWESOME library.
I have few questions while using this module, mainly about CollectionView

1. I make a new database table by using
```python
run_date = page.children.add_new(PageBlock, title='Runs')

db_fold = run_date.children.add_new(CollectionViewBlock)
db_fold.collection = client.get_collection(
client.create_record('collection', parent=db_fold, schema=schema('debug'))
)
db_fold.title = 'Fold 1'
db_fold.views.add_new(view_type='table')
```
the line that I wrote `client.create_record` ~, I use `schema` argument to build the columns but it has different orders from what I intended. They are sorted in alphabetical order which is not what I expect...! For example, if I have schemas like
```python
schema = {
{'title': {'name': 'Title', 'type': 'text'},
{'some column': {'name': 'z', 'type': 'text'},
{'some column2': {'name': 'a', 'type': 'text'},
}
```
So I should expect the columns in order of title - z - a but it shows up with title - a - z! Not a big issue but just want to figure out is there any way to keep the orders from the dictionary.
plus) What's the difference between the first key and encapsulated key 'name'? I guess the one that shows up on the notion is the 'name' but I was just wondering the rold of the key (in this case, 'title', 'some column', 'some column2')

2. Settings the Property type of the schema
We can set the property type by giving 'type' on the schema dictionary. Is there any list for them? I want to make advanced property 'Created Time' but haven't found out which argument to put in.

Thank you again for sharing this module. 🙏

Contributor guide

No contributing guide indexed for this repository

Research direction

Start from the Python entry points shown in the issue: client.create_record, schema, CollectionViewBlock, and views.add_new. Trace how schema keys and property types are passed into the table view, then determine what behavior or documentation is needed for column ordering and Created Time support. Done means the ordering and supported schema types are explicitly handled or documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.