Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Column('new', String())
)
historyTable = Table('History', metadata,
Column('id', Integer, primary_key = True),
Column('movie', Integer, ForeignKey('Movie.id')),
Column('value', String()),
Column('status', String())
)
subtitleHistoryTable = Table('SubtitleHistory', metadata,
Column('id', Integer, primary_key = True),
Column('movie', Integer, ForeignKey('Movie.id')),
Column('file', String()),
Column('subtitle', String()),
Column('status', String()),
Column('data', Text())
)
qualityTemplateTable = Table('QualityTemplate', metadata,
Column('id', Integer, primary_key = True),
Column('name', Integer, unique = True),
Column('label', String()),
Column('order', Integer),
Column('waitFor', Integer, default = 0),
Column('custom', Boolean),
Column('default', Boolean)
)
qualityTemplateTypeTable = Table('QualityTemplateType', metadata,
Column('id', Integer, primary_key = True),
Column('quality', Integer, ForeignKey('QualityTemplate.id')),
from sqlalchemy.types import Boolean, DateTime, Integer, LargeBinary, \
UnicodeText
from abilian.core import sqlalchemy as sa_types
from abilian.core.util import fqcn
from .base import SEARCHABLE, SYSTEM, IdMixin, Indexable, TimestampedMixin, db
__all__ = ["User", "Group", "Principal"]
# Tables for many-to-many relationships
following = Table(
"following",
db.Model.metadata,
Column("follower_id", Integer, ForeignKey("user.id")),
Column("followee_id", Integer, ForeignKey("user.id")),
UniqueConstraint("follower_id", "followee_id"),
)
membership = Table(
"membership",
db.Model.metadata,
Column(
"user_id",
Integer,
ForeignKey("user.id", onupdate="CASCADE", ondelete="CASCADE"),
),
Column(
"group_id",
Integer,
ForeignKey("group.id", onupdate="CASCADE", ondelete="CASCADE"),
),
schema.Column('timestamp',TIMESTAMP),
schema.Column('url_id',INTEGER),
schema.Column('label_id',INTEGER),
schema.Column('pagespeed_id',INTEGER),
schema.Column('requests',MEDIUMINT),
schema.Column('size',MEDIUMINT),
schema.Column('time',MEDIUMINT),
schema.Column('har_key',CHAR(24)),
)
pagespeed_table = schema.Table('PAGESPEED',meta.metadata,
schema.Column('id',INTEGER,primary_key=True),
schema.Column('score',TINYINT),
schema.Column('avoid_import',TINYINT),
schema.Column('avoid_bad_req',TINYINT),
schema.Column('combine_images',TINYINT),
schema.Column('defer_load_js',TINYINT),
schema.Column('defer_pars_js',TINYINT),
schema.Column('enable_keepalive',TINYINT),
schema.Column('enable_gzip',TINYINT),
schema.Column('inline_css',TINYINT),
schema.Column('inline_js',TINYINT),
schema.Column('leverage_cache',TINYINT),
schema.Column('make_redirects_cacheable',TINYINT),
schema.Column('minify_css',TINYINT),
schema.Column('minify_html',TINYINT),
schema.Column('minify_js',TINYINT),
schema.Column('minimize_redirects',TINYINT),
schema.Column('minimize_req_size',TINYINT),
schema.Column('optimize_images',TINYINT),
schema.Column('optimize_order',TINYINT),
schema.Column('prefer_async',TINYINT),
from sqlalchemy.schema import Table, MetaData, Column
from sqlalchemy.types import Integer, String, Boolean
from sqlalchemy.engine import create_engine
from config import db_url
engine = create_engine(db_url, echo=False)
metadata = MetaData()
t3_reply = Table('t3_reply', metadata,
Column('id', Integer, primary_key=True),
Column('target_id', String(8), unique=True),
Column('author_name', String(21)),
Column('reply_id', String(8)),
Column('target_created', Integer),
Column('topic_flags', Integer),
Column('previous_topic_flags', Integer),
Column('extra_flags', Integer),
Column('is_set', Boolean),
Column('is_ignored', Boolean),
Column('is_deletable', Boolean))
def create_database():
metadata.create_all(engine)
pairs.append((binary.right, binary.left))
elif binary.right in consider_as_foreign_keys and \
(binary.left is binary.right or
binary.left not in consider_as_foreign_keys):
pairs.append((binary.left, binary.right))
elif consider_as_referenced_keys:
if binary.left in consider_as_referenced_keys and \
(binary.right is binary.left or
binary.right not in consider_as_referenced_keys):
pairs.append((binary.left, binary.right))
elif binary.right in consider_as_referenced_keys and \
(binary.left is binary.right or
binary.left not in consider_as_referenced_keys):
pairs.append((binary.right, binary.left))
else:
if isinstance(binary.left, schema.Column) and \
isinstance(binary.right, schema.Column):
if binary.left.references(binary.right):
pairs.append((binary.right, binary.left))
elif binary.right.references(binary.left):
pairs.append((binary.left, binary.right))
pairs = []
else:
out = np.fromstring(value, sep=',')
return out
# table schema
class Poster(Base):
__tablename__ = 'poster'
id = Column(Integer, primary_key=True)
title = Column(String, nullable=True)
url_img = Column(String, nullable=True)
path_img = Column(String, nullable=True)
path_thumb = Column(String, nullable=True)
features = Column(ARRAY, nullable=True)
features_pca = Column(ARRAY, nullable=True)
closest_posters = Column(String, nullable=True)
title_display = Column(String, nullable=True)
def __init__(self, dict_poster=None):
if dict_poster is None:
pass
else:
self.title = dict_poster.get('title', '')
self.url_img = dict_poster.get('url_img', '')
self.path_img = dict_poster.get('path_img', '')
self.path_thumb = dict_poster.get('path_thumb', '')
self.features = dict_poster.get('features', '')
self.features_pca = dict_poster.get('features_pca', '')
self.closest_posters = dict_poster.get('closest_posters', '')
self.title_display = dict_poster.get('title_display', '')
from sqlalchemy.types import Integer, DateTime, String
from aiida.utils import timezone
from aiida.backends.sqlalchemy.models.base import Base
from aiida.common.exceptions import ValidationError
__copyright__ = u"Copyright (c), This file is part of the AiiDA platform. For further information please visit http://www.aiida.net/. All rights reserved."
__license__ = "MIT license, see LICENSE.txt file."
__authors__ = "The AiiDA team."
__version__ = "0.7.1"
class DbLock(Base):
__tablename__ = "db_dblock"
key = Column(String(255), primary_key=True)
creation = Column(DateTime(timezone=True), default=timezone.now)
timeout = Column(Integer)
owner = Column(String(255))
def __init__(self, **kwargs):
if 'owner' not in kwargs or not kwargs["owner"]:
raise ValidationError("The field owner can't be empty")
self.__init__(**kwargs)
from ce1sus.db.classes.cstix.common.relations import _REL_STATEMENT_STRUCTUREDTEXT, _REL_STATEMENT_INFORMATIONSOURCE, _REL_STATEMENT_CONFIDENCE
from ce1sus.db.classes.cstix.indicator.relations import _REL_INDICATOR_STATEMENT, _REL_TESTMECHANISM_STATEMENT
# from ce1sus.db.classes.cstix.relations import _REL_MARKINGSTRUCTURE_STATEMENT
from ce1sus.db.classes.internal.corebase import UnicodeType
from ce1sus.db.common.session import Base
__author__ = 'Weber Jean-Paul'
__email__ = 'jean-paul.weber@govcert.etat.lu'
__copyright__ = 'Copyright 2013-2014, GOVCERT Luxembourg'
__license__ = 'GPL v3+'
class Statement(Entity, Base):
timestamp = Column('timestamp', DateTime, default=datetime.utcnow())
timestamp_precision = Column('timestamp_precision', UnicodeType(10), default=u'second')
value = Column('value', UnicodeType(255), nullable=False)
description = relationship('StructuredText', secondary=_REL_STATEMENT_STRUCTUREDTEXT, uselist=False)
source = relationship('InformationSource', uselist=False, secondary=_REL_STATEMENT_INFORMATIONSOURCE)
confidence = relationship('Confidence', uselist=False, secondary=_REL_STATEMENT_CONFIDENCE)
_PARENTS = ['base_test_mechanism',
'indicator',
'coa_impact',
'coa_cost',
'coa_efficacy',
'simple_marking_structure'
]
coa_impact = relationship('CourseOfAction', secondary=_REL_COA_IMPACT_STATEMENT, uselist=False)
coa_cost = relationship('CourseOfAction', secondary=_REL_COA_COST_STATEMENT, uselist=False)
session=session,
engine=processor.get_engine(),
metadata=processor.get_metadata(),
db=processor.get_destdb(),
))
# Make a temporary table in each database (note: the Table objects become
# affiliated to their engine, I think, so make separate ones for each).
log.info(f"... using {len(databases)} destination database(s)")
log.info("... dropping (if exists) and creating temporary table(s)")
for database in databases:
temptable = Table(
nlpdef.get_temporary_tablename(),
database.metadata,
Column(FN_SRCPKVAL, BigInteger), # not PK, as may be a hash
Column(FN_SRCPKSTR, String(MAX_STRING_PK_LENGTH)),
**TABLE_KWARGS
)
temptable.drop(database.engine, checkfirst=True)
temptable.create(database.engine, checkfirst=True)
database.temptable = temptable
# Insert PKs into temporary tables
n = count_star(ifconfig.get_source_session(), ifconfig.get_srctable())
log.info(f"... populating temporary table(s): {n} records to go; "
f"working in chunks of {chunksize}")
i = 0
records = [] # type: List[Dict[str, Any]]
for pkval, pkstr in ifconfig.gen_src_pks():
i += 1
if report_every and i % report_every == 0:
aiida_query = _QueryProperty(_AiidaQuery)
id = Column(Integer, primary_key=True)
uuid = Column(UUID(as_uuid=True), default=get_new_uuid, unique=True)
ctime = Column(DateTime(timezone=True), default=timezone.now)
mtime = Column(DateTime(timezone=True), default=timezone.now, onupdate=timezone.now)
user_id = Column(Integer, ForeignKey('db_dbuser.id'))
user = relationship('DbUser')
label = Column(String(255), index=True)
description = Column(Text)
nodeversion = Column(Integer)
lastsyncedversion = Column(Integer)
state = Column(ChoiceType((_, _) for _ in wf_states),
default=wf_states.INITIALIZED)
report = Column(Text)
data = relationship("DbWorkflowData", backref='parent')
# XXX the next three attributes have "blank=False", but can be null. It may
# be needed to add some validation for this, but only at commit time.
# To do so: see https://stackoverflow.com/questions/28228766/running-cleaning-validation-code-before-committing-in-sqlalchemy
module = Column(Text)
module_class = Column(Text)
script_path = Column(Text)