Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
cc59c89d
Commit
cc59c89d
authored
Apr 03, 2015
by
Mathieu Rodic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEATURE] direct implementation of the Node model with SQLAlchemy
parent
d086dfd5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
1 deletion
+17
-1
db.py
gargantext_web/db.py
+17
-1
No files found.
gargantext_web/db.py
View file @
cc59c89d
...
@@ -56,6 +56,23 @@ for model_name, model in models.__dict__.items():
...
@@ -56,6 +56,23 @@ for model_name, model in models.__dict__.items():
NodeNgram
=
Node_Ngram
NodeNgram
=
Node_Ngram
NodeResource
=
Node_Resource
NodeResource
=
Node_Resource
# manually declare the Node table...
from
datetime
import
datetime
from
sqlalchemy.types
import
*
from
sqlalchemy.schema
import
Column
,
ForeignKey
from
sqlalchemy.dialects.postgresql
import
JSONB
from
sqlalchemy.orm
import
relationship
,
aliased
# class Node(Base):
# __tablename__ = 'node_node'
# id = Column(Integer, primary_key=True)
# user_id = Column(Integer, ForeignKey('auth_user.id', ondelete='CASCADE'), index=True, nullable=False)
# type_id = Column(Integer, ForeignKey('node_nodetype.id', ondelete='CASCADE'), index=True, nullable=False)
# name = Column(String(255))
# language_id = Column(Integer, ForeignKey('node_language.id', ondelete='CASCADE'), index=True, nullable=False)
# date = Column(DateTime(), default=datetime.utcnow, nullable=True)
# metadata = Column(JSONB, default={}, nullable=False)
# debugging tool, to translate SQLAlchemy queries to string
# debugging tool, to translate SQLAlchemy queries to string
...
@@ -67,7 +84,6 @@ def literalquery(statement, dialect=None):
...
@@ -67,7 +84,6 @@ def literalquery(statement, dialect=None):
purposes only. Executing SQL statements with inline-rendered user values is
purposes only. Executing SQL statements with inline-rendered user values is
extremely insecure.
extremely insecure.
"""
"""
from
datetime
import
datetime
import
sqlalchemy.orm
import
sqlalchemy.orm
if
isinstance
(
statement
,
sqlalchemy
.
orm
.
Query
):
if
isinstance
(
statement
,
sqlalchemy
.
orm
.
Query
):
if
dialect
is
None
:
if
dialect
is
None
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment