Skip to content

Put individual table methods into their respective classes #12

@ankitchiplunkar

Description

@ankitchiplunkar

Is your feature request related to a problem? Please describe.
The table methods are currently situated in the api.py file, this makes it not lean.

Describe the solution you'd like
There are two possible options:

  1. Import classes from ether_sql library, then connecting these classes to their respective tables in the current psql. To add more methods we can inherit the class from ether_sql and add methods in them.
from ether_sql.models import Blocks

class ApiBlocks(Blocks):
    connect_to_table('blocks')

    @classmethod
    def current_blockNumber():
        logic_of_method 
  1. The second option is not relying on ether_sql library but connecting to the table as implemented in
    Blocks=ss.get_table_object('blocks')
    and implementing the methods on this class directly.

I would prefer option 1 since, we can then reuse the ether_sqlfunctions as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions