Commit 2ac62ab1 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[DOCKERFILE] for notebook.

parent d6ad20ef
......@@ -2,6 +2,8 @@ from gargantext.util.db import session
from gargantext.util.files import upload
from gargantext.constants import *
from sqlalchemy_utils.types import TSVectorType
from datetime import datetime
from .base import Base, Column, ForeignKey, relationship, TypeDecorator, Index, \
......@@ -60,13 +62,16 @@ class Node(Base):
id = Column(Integer, primary_key=True)
typename = Column(NodeType, index=True)
# foreign keys
user_id = Column(Integer, ForeignKey(User.id, ondelete='CASCADE'))
parent_id = Column(Integer, ForeignKey('nodes.id', ondelete='CASCADE'))
user_id = Column(Integer, ForeignKey(User.id, ondelete='CASCADE'))
parent_id = Column(Integer, ForeignKey('nodes.id', ondelete='CASCADE'))
# main data
name = Column(String(255))
date = Column(DateTime(timezone=True), default=datetime.now)
# metadata (see https://bashelton.com/2014/03/updating-postgresql-json-fields-via-sqlalchemy/)
hyperdata = Column(JSONB, default=dict)
hyperdata = Column(JSONB, default=dict)
# To make search possible uncomment the line below
#search_vector = Column(TSVectorType('hyperdata'))
user = relationship(User)
parent = relationship('Node', remote_side=[id])
......
......@@ -45,6 +45,7 @@ class HalCrawler(Crawler):
, uri_s
, isbn_s
, issue_s
, docType_s
, journalPublisher_s
"""
#, authUrl_s
......
......@@ -5,8 +5,11 @@ from gargantext.util.json import json_dumps
########################################################################
# get engine, session, etc.
########################################################################
import sqlalchemy as sa
from sqlalchemy.orm import sessionmaker, scoped_session
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import delete
from sqlalchemy_searchable import make_searchable
def get_engine():
from sqlalchemy import create_engine
......@@ -18,6 +21,13 @@ def get_engine():
engine = get_engine()
# To make Full Text search possible, uncomment lines below
# https://sqlalchemy-searchable.readthedocs.io/
#sa.orm.configure_mappers()
Base = declarative_base()
#Base.metadata.create_all(engine)
#make_searchable()
session = scoped_session(sessionmaker(bind=engine))
......
......@@ -15,9 +15,9 @@ RUN apt-get update && \
apt-utils ca-certificates locales \
sudo aptitude gcc g++ wget git vim \
build-essential make \
postgresql-9.5 postgresql-client-9.5 postgresql-contrib-9.5 \
postgresql-server-dev-9.5 libpq-dev libxml2 \
postgresql-9.5 postgresql-client-9.5 postgresql-contrib-9.5
postgresql-9.6 postgresql-client-9.6 postgresql-contrib-9.6 \
postgresql-server-dev-9.6 libpq-dev libxml2 \
postgresql-9.6 postgresql-client-9.6 postgresql-contrib-9.6
### Configure timezone and locale
......@@ -37,7 +37,7 @@ ENV LC_ALL fr_FR.UTF-8
### Install main dependencies and python packages based on Debian distrib
RUN echo "############# PYTHON DEPENDENCIES ###############"
RUN apt-get update && apt-get install -y \
libxml2-dev xml-core libgfortran-5-dev \
libxml2-dev xml-core libgfortran-6-dev \
libpq-dev \
python3.5 \
python3-dev \
......@@ -47,8 +47,8 @@ RUN apt-get update && apt-get install -y \
# python dependencies
python3-pip \
# for lxml
libxml2-dev libxslt-dev
#libxslt1-dev zlib1g-dev
libxml2-dev libxslt-dev \
libxslt1-dev zlib1g-dev
# UPDATE AND CLEAN
RUN apt-get update && apt-get autoclean &&\
......
......@@ -34,3 +34,4 @@ requests-futures==0.9.7
bs4==0.0.1
requests==2.10.0
alembic>=0.9.2
SQLAlchemy-Searchable==0.10.4
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment