openknowledge-archive / dpr-api

DEPRECATED - Data Package Registry API and Frontend
http://frictionlessdata.io/
MIT License
7 stars 6 forks source link

Refactor Package model to have descriptor and readme #411

Closed zelima closed 7 years ago

zelima commented 7 years ago

Currently we are getting README and datapackage.json for package from PackageTag table. We have OneToMany relationship between Package and PackageTag tables. We need them to get it directly from Package table

Acceptance Criteria

Tasks

Task list for a non-epic issue

Analysis

class Package(db.Model):
    __tablename__ = "package"

    ...
    tags = relationship("PackageTag", back_populates="package")
class PackageTag(db.Model):
    __tablename__ = 'package_tag'

   ...    
    descriptor = db.Column(db.JSON)
    readme = db.Column(db.TEXT)
    package = relationship("Package", back_populates="tags")

We want to have descriptor and readme columns in Package table as well, that will by default be same as latest updated tag in PackageTag table.

rufuspollock commented 7 years ago

@zelima looks pretty accurate:

zelima commented 7 years ago

@rufuspollock this confused me a little bit.

rufuspollock commented 7 years ago

@zelima

So unless tag is explicitly set we are not touching PackageTag at all? all the inf goes into Package table correct?

Yes

Are not we actually tagging with latest behind the scenes? should we get rid of this action?

Yes, I'd get rid of this. "latest" is not a tag really. Think of git(hub) - "master" HEAD is not a tag - tags are things you have explicitly created.

I'm loosing the track of why do we need PackageTag table at all

How do you create tags? Read the user story again re tags: they are like git tags - a way to label (and make a copy) of the data package at a given point. We need somewhere to store that info.

BTW: it sounds like adding documentation about Tags/Versions to the main documentation explaining these ideas and the implementation could be useful.

zelima commented 7 years ago

FIXED. tags are explicitly created. Metadata is saved into Package table