Giter Site home page Giter Site logo

python-baserow-client's Introduction

๐Ÿ‘‹ Hi, I'm Niklas. I like Python, Kubernetes and Tooling.

GitHub Streak

python-baserow-client's People

Contributors

dermasmid avatar dretay avatar luc-languagetools avatar niklasrosenstein avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

python-baserow-client's Issues

Consider caching/session for ORM

Most ORMs require a "session" that keeps track of data during a sequence of operations on the ORM layer (e.g. querying, creating, updating or deleting rows). In ORMs for transactional databases, the session often also represents the transaction. Baserow is not transactional, but we could still benefit from caching within the same session when querying. This would be particularly important when using linked rows with back-referecning columns in Baserow which could infinitely load rows of table A and B when loading either once within the same session should be sufficient.

List table fields does not work if table contains formula fields

Thanks a lot for writing this python baserow client! This is very useful for us.

Currently when I attempt to list table fields:

for db in client.list_database_table_fields(580):
    print(db)     

I get an error:

  File ~/micromamba/envs/cads_data_exchange/lib/python3.10/site-packages/dat
 โ”‚  abind/json/converters.py:147, in <genexpr>(.0)
 โ”‚      143     def _length_check() -> None:
 โ”‚      144         pass
 โ”‚      146 values: t.Iterable[t.Any] = (
 โ”‚  --> 147     ctx.spawn(val, item_type, idx).convert()
 โ”‚      148     for idx, (val, item_type) in enumerate(zip(ctx.value, item_typ
 โ”‚  es_iterator))
 โ”‚      149 )
 โ”‚      151 if ctx.direction == Direction.SERIALIZE:
 โ”‚      152     if not isinstance(ctx.value, python_type):
 โ”‚
 โ”‚  File ~/micromamba/envs/cads_data_exchange/lib/python3.10/site-packages/dat
 โ”‚  abind/core/context.py:123, in Context.convert(self)
 โ”‚      120 def convert(self) -> t.Any:
 โ”‚      121     """Invoke the #convert_func with *self*."""
 โ”‚  --> 123     return self.convert_func(self)
 โ”‚
 โ”‚  File ~/micromamba/envs/cads_data_exchange/lib/python3.10/site-packages/dat
 โ”‚  abind/core/converter.py:84, in Module.convert(self, ctx)
 โ”‚       82 for converter in self.get_converters(ctx):
 โ”‚       83     try:
 โ”‚  ---> 84         return converter.convert(ctx)
 โ”‚       85     except NotImplementedError:
 โ”‚       86         pass
 โ”‚
 โ”‚  File ~/micromamba/envs/cads_data_exchange/lib/python3.10/site-packages/dat
 โ”‚  abind/json/converters.py:805, in UnionConverter.convert(self, ctx)
 โ”‚      803         raise ConversionError.expected(self, ctx, t.Mapping)
 โ”‚      804     member_name = self._get_deserialize_member_name(ctx, ctx.value
 โ”‚  , style, discriminator_key)
 โ”‚  --> 805     member_type = union.members.get_type_by_id(member_name)
 โ”‚      807 else:
 โ”‚      808     # Identify the member type based on the Python value type.
 โ”‚      809     member_name = union.members.get_type_id(type(ctx.value))
 โ”‚
 โ”‚  File ~/micromamba/envs/cads_data_exchange/lib/python3.10/site-packages/dat
 โ”‚  abind/core/union.py:104, in StaticUnionMembers.get_type_by_id(self, type_i
 โ”‚  d)
 โ”‚      102     member = self.members[type_id]
 โ”‚      103 except KeyError:
 โ”‚  --> 104     raise ValueError(f"{type_id!r} is not a type ID of {self}")
 โ”‚      106 if isinstance(member, types.FunctionType):
 โ”‚      107     member = self._eval_cache[type_id] = member()
 โ”‚
 โ”‚  ValueError: 'formula' is not a type ID of StaticUnionMembers(members={'tex
 โ”‚  t': <class 'baserow.field_types.TextTableField'>, 'long_text': <class 'bas
 โ”‚  erow.field_types.LongTextTableField'>, 'number': <class 'baserow.field_typ
 โ”‚  es.NumberTableField'>, 'single_select': <class 'baserow.field_types.Single
 โ”‚  SelectTableField'>, 'url': <class 'baserow.field_types.UrlTableField'>, 'l
 โ”‚  ink_row': <class 'baserow.field_types.LinkRowTableField'>, 'boolean': <cla
 โ”‚  ss 'baserow.field_types.BooleanTableField'>, 'file': <class 'baserow.field
 โ”‚  _types.FileTableField'>})

It seems like formula fields had not been implemented yet?

ORM support for single-select columns

  • Reading single-select cells from Baserow gives back an object of the form {"id": 0, "name": "Option", "color": "#33aaff"}. The ORM should convert this into a Python type.
  • When updating the value of a single-select from Python, the ID of the option needs to be specified. The ORM should allow a string value to be set instead and be able to translate that to the ID internally (the Baserow API expects the option ID when creating/updating rows).
    • This means we either need to track the available options in the database mapping or query it once the first time that information is needed (if it's possible to do that with a long lived token). If both is possible, maybe we should give people the option. (Frequently changing the available options would require frequent re-generating of the database mapping).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.