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.

Including relational data?

See original GitHub issue

I was messing around with PostgREST before this and they have the concept of resource embedding to pull in related data. Is there anything similar here? It also seems like https://github.com/pyeve/eve-sqlalchemy supports this.

With sandman(1), it seems like the docs suggest that there should be links - altho there is a field named links, it’s not clear how that relates to items: image

With sandman2, I don’t even see a link: image

Schema constructed with a simple many-to-many relationship:

users_items_assoc = Table('users_items_assoc', Base.metadata,
                          Column('users_items_assoc_id', Integer, primary_key=True),
                          Column('user_id', Integer, ForeignKey('users.id')),
                          Column('item_id', Integer, ForeignKey('items.id'))
                          )

class User(Base):
    __tablename__ = 'users'
    id = Column(Integer, primary_key=True)
    name = Column(String)
    nickname = Column(String)

    items = relationship('Item', back_populates='users', secondary=users_items_assoc)

    def __repr__(self):
        return f'{self.name}'


class Item(Base):
    __tablename__ = 'items'
    id = Column(Integer, primary_key=True)
    name = Column(String)
    description = Column(String)

    users = relationship('User', back_populates='items', secondary=users_items_assoc)
    # TODO: add image, upc, and so on

    def __repr__(self):
        return f'{self.name}'

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
jeffknuppcommented, Jan 16, 2019

@jcrben @rrjanbiah sandman2 uses the Link Header, which is how this information is meant to be conveyed; you’ll find all of the data you’re looking for there.

0reactions
mrhaojicommented, Apr 16, 2020

Where can I find the “Link Header”? in the response Header? @jeffknupp

Read more comments on GitHub >

github_iconTop Results From Across the Web

Relational Databases Explained - IBM
A relational database organizes data into rows and columns, which collectively form a table. Data is typically structured across multiple tables ...
Read more >
13 Relational data - R for Data Science - Hadley Wickham
The most common place to find relational data is in a relational database management system (or RDBMS), a term that encompasses almost all...
Read more >
What is a Relational Database? - TechTarget
A relational database is a collection of information that organizes data points with defined relationships for easy access. In the relational database model ......
Read more >
What is a Relational Database (RDBMS)? - Oracle
A relational database is a type of database that stores and provides access to data points that are related to one another. Relational...
Read more >
What Is A Relational Database (RDBMS)? - Google Cloud
A relational database is a collection of information that organizes data in predefined relationships where data is stored in one or more tables...
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