Giter Site home page Giter Site logo

Patch method unreliable? about safrs HOT 2 CLOSED

tjbanks avatar tjbanks commented on September 28, 2024
Patch method unreliable?

from safrs.

Comments (2)

thomaxxl avatar thomaxxl commented on September 28, 2024

Hi,

This shouldn't happen and I haven't encountered this problem before.
Can you provide more details so I can reproduce this?
I guess you're using postgres? Can you switch to sqlite to check if the problem still appears?

from safrs.

tjbanks avatar tjbanks commented on September 28, 2024

That seems to work well - maybe it's a postgres specific issue? Some work and some don't - below, the first model works in postgres/safrs but the second doesn't. And the only difference being the second uses a text type in a tsvector. I'll investigate that route and close the issue - thanks for your suggestion!

class AcademicFunder(BaseModelTS):

    __tablename__ = 'academic_funder'

    id = db.Column(db.Integer(),primary_key=True)
    name = db.Column(db.String(),nullable=False)
    doi = db.Column(db.String(),nullable=False,unique=True)
    alt_names = db.Column(db.String(),nullable=True)
    location_name = db.Column(db.String(),nullable=True)
    
    search_vector = db.Column(TSVectorType('name','doi','alt_names','location_name'))

class AcademicWork(BaseModelTS):
    """Academic work model generalized

    """
    __tablename__ = 'academic_work'

    id = db.Column(db.BigInteger(), primary_key=True)
    doi = db.Column(db.String(),nullable=True)
    title = db.Column(db.String(),nullable=True)
    first_author_name = db.Column(db.String(),nullable=True)
    abstract = db.Column(db.String(),nullable=True)
    abstract_en = db.Column(db.String(),nullable=True)
    full_text = db.Column(db.Text(),nullable=True)
    full_text_en = db.Column(db.Text(),nullable=True)
    published = db.Column(db.DateTime(), nullable=True)
    source = db.Column(db.String(),nullable=True)
    score = db.Column(db.Float(),nullable=True)
    work_type = db.Column(db.String(),nullable=True)
    container_title = db.Column(db.String(),nullable=True)
    subjects = db.Column(db.String(),nullable=True)    

    urls = db.relationship('Url',
                secondary='academic_work_url',
                backref=db.backref('academic_work', lazy='dynamic'))

    funders = db.relationship('AcademicFunder',
                secondary='academic_work_funder',
                backref=db.backref('academic_work', lazy='dynamic'))


    authors = db.relationship('Entity',
                secondary='academic_work_author',
                backref=db.backref('academic_work', lazy='dynamic'))


    search_vector = db.Column(TSVectorType('title','title_en','abstract','abstract_en','full_text','full_text_en','container_title','subjects'))

from safrs.

Related Issues (20)

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.