Skip to content

Commit

Permalink
SQLAlchemy: initial commit
Browse files Browse the repository at this point in the history
* Ands and reworks models and uses db namespace.
  • Loading branch information
jirikuncar committed Nov 3, 2012
1 parent a366e2d commit 3880f2e
Show file tree
Hide file tree
Showing 59 changed files with 9,116 additions and 61 deletions.
16 changes: 7 additions & 9 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
## script.

## Initialize autoconf and automake:
AC_INIT([invenio],
m4_esyscmd([./git-version-gen .tarball-version]),
[[email protected]])
AC_INIT([invenio],[m4_esyscmd(./git-version-gen .tarball-version)],[[email protected]])
AM_INIT_AUTOMAKE([tar-ustar])

## By default we shall install into /opt/invenio. (Do not use
Expand All @@ -42,7 +40,7 @@ AM_GNU_GETTEXT_VERSION(0.14.4)

## Check for MySQL client:
AC_MSG_CHECKING(for mysql)
AC_ARG_WITH(mysql, AC_HELP_STRING([--with-mysql], [path to a specific MySQL binary (optional)]), MYSQL=${withval})
AC_ARG_WITH(mysql, AS_HELP_STRING([--with-mysql],[path to a specific MySQL binary (optional)]), MYSQL=${withval})
if test -n "$MYSQL"; then
AC_MSG_RESULT($MYSQL)
else
Expand All @@ -57,7 +55,7 @@ fi

## Check for Python:
AC_MSG_CHECKING(for python)
AC_ARG_WITH(python, AC_HELP_STRING([--with-python], [path to a specific Python binary (optional)]), PYTHON=${withval})
AC_ARG_WITH(python, AS_HELP_STRING([--with-python],[path to a specific Python binary (optional)]), PYTHON=${withval})
if test -n "$PYTHON"; then
AC_MSG_RESULT($PYTHON)
else
Expand All @@ -72,7 +70,7 @@ fi

## Check for OpenOffice.org Python binary:
AC_MSG_CHECKING(for OpenOffice.org Python binary)
AC_ARG_WITH(openoffice-python, AC_HELP_STRING([--with-openoffice-python], [path to a specific OpenOffice.org Python binary (optional)]), OPENOFFICE_PYTHON=`which ${withval}`)
AC_ARG_WITH(openoffice-python, AS_HELP_STRING([--with-openoffice-python],[path to a specific OpenOffice.org Python binary (optional)]), OPENOFFICE_PYTHON=`which ${withval}`)

if test -z "$OPENOFFICE_PYTHON"; then
OPENOFFICE_PYTHON=`locate -l 1 -r "o.*office/program/python$"`
Expand Down Expand Up @@ -415,7 +413,7 @@ fi

## Check for CLISP:
AC_MSG_CHECKING(for clisp)
AC_ARG_WITH(clisp, AC_HELP_STRING([--with-clisp], [path to a specific CLISP binary (optional)]), CLISP=${withval})
AC_ARG_WITH(clisp, AS_HELP_STRING([--with-clisp],[path to a specific CLISP binary (optional)]), CLISP=${withval})
if test -n "$CLISP"; then
AC_MSG_RESULT($CLISP)
else
Expand All @@ -434,7 +432,7 @@ fi

## Check for CMUCL:
AC_MSG_CHECKING(for cmucl)
AC_ARG_WITH(cmucl, AC_HELP_STRING([--with-cmucl], [path to a specific CMUCL binary (optional)]), CMUCL=${withval})
AC_ARG_WITH(cmucl, AS_HELP_STRING([--with-cmucl],[path to a specific CMUCL binary (optional)]), CMUCL=${withval})
if test -n "$CMUCL"; then
AC_MSG_RESULT($CMUCL)
else
Expand All @@ -457,7 +455,7 @@ fi

## Check for SBCL:
AC_MSG_CHECKING(for sbcl)
AC_ARG_WITH(sbcl, AC_HELP_STRING([--with-sbcl], [path to a specific SBCL binary (optional)]), SBCL=${withval})
AC_ARG_WITH(sbcl, AS_HELP_STRING([--with-sbcl],[path to a specific SBCL binary (optional)]), SBCL=${withval})
if test -n "$SBCL"; then
AC_MSG_RESULT($SBCL)
else
Expand Down
1 change: 1 addition & 0 deletions modules/bibauthorid/lib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pylib_DATA = \
bibauthorid_general_utils.py \
bibauthorid_name_utils.py \
bibauthorid_recipes.py \
bibauthorid_model.py \
bibauthorid_templates.py \
bibauthorid_wedge.py \
bibauthorid_webauthorprofileinterface.py
Expand Down
221 changes: 221 additions & 0 deletions modules/bibauthorid/lib/bibauthorid_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
# -*- coding: utf-8 -*-
#
## Author: Jiri Kuncar <[email protected]>
##
## This file is part of Invenio.
## Copyright (C) 2011, 2012 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) any later version.
##
## Invenio is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Invenio; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02D111-1307, USA.

"""
bibauthorid database models.
"""

# General imports.
from invenio.sqlalchemyutils import db

# Create your models here.

#FIX ME Add db.relationships

class AidAUTHORNAMES(db.Model):
"""Represents a AidAUTHORNAMES record."""
def __init__(self):
pass
__tablename__ = 'aidAUTHORNAMES'
__table_args__ = {'useexisting':True}#, 'extend_existing': True}
id = db.Column(db.BigInteger(15), nullable=False,
primary_key=True,
autoincrement=True)
Name = db.Column(db.String(255), nullable=False,
index=True)
bibrefs = db.Column(db.String(200), nullable=False,
index=True)
db_name = db.Column(db.String(255), nullable=True,
index=True)

class AidAUTHORNAMESBIBREFS(db.Model):
"""Represents a AidAUTHORNAMESBIBREFS record."""
def __init__(self):
pass
__tablename__ = 'aidAUTHORNAMESBIBREFS'
id = db.Column(db.BigInteger(15), nullable=False,
primary_key=True,
autoincrement=True)
Name_id = db.Column(db.BigInteger(15), nullable=False,
index=True)
bibref = db.Column(db.String(200), nullable=False,
index=True)

class AidCACHE(db.Model):
"""Represents a AidCACHE record."""
def __init__(self):
pass
__tablename__ = 'aidCACHE'
id = db.Column(db.Integer(15), nullable=False,
primary_key=True,
autoincrement=True)
object_name = db.Column(db.String(120), nullable=False,
index=True)
object_key = db.Column(db.String(120), nullable=False,
index=True)
object_value = db.Column(db.Text, nullable=True)
last_updated = db.Column(db.DateTime, nullable=False,
index=True)


class AidDOCLIST(db.Model):
"""Represents a AidDOCLIST record."""
def __init__(self):
pass
__tablename__ = 'aidDOCLIST'
id = db.Column(db.BigInteger(15), nullable=False,
primary_key=True,
autoincrement=True)
bibrecID = db.Column(db.BigInteger(15), nullable=False,
index=True)
processed_author = db.Column(db.BigInteger(15), nullable=True,
index=True)

class AidPERSONID(db.Model):
"""Represents a AidPERSONID record."""
def __init__(self):
pass
__tablename__ = 'aidPERSONID'
id = db.Column(db.BigInteger(15), nullable=False,
primary_key=True,
autoincrement=True)
personid = db.Column(db.BigInteger(15), nullable=False,
index=True)
tag = db.Column(db.String(50), nullable=False,
index=True)
data = db.Column(db.String(250), nullable=False,
index=True)
flag = db.Column(db.Integer(11), nullable=False, server_default='0',
index=True)
lcul = db.Column(db.Integer(11), nullable=False, server_default='0',
index=True)
#__table_args__ = {#'indexes': (db.Index('tdf-b', tag, data, flag),
# # db.Index('ptf-b', personid, data, flag)),
# 'extend_existing': True}

class AidREALAUTHORDATA(db.Model):
"""Represents a AidREALAUTHORDATA record."""
def __init__(self):
pass
__tablename__ = 'aidREALAUTHORDATA'
id = db.Column(db.BigInteger(15), nullable=False,
primary_key=True,
autoincrement=True)
realauthorID = db.Column(db.BigInteger(15), nullable=False)
tag = db.Column(db.String(50), nullable=False,
index=True)
value = db.Column(db.String(255), nullable=False,
index=True)
va_count = db.Column(db.Integer(8), nullable=False,
server_default='0')
va_names_p = db.Column(db.Double, nullable=False,
server_default='0')
va_p = db.Column(db.Double, nullable=False, server_default='0')
#__table_args__ = (db.Index('realauthorID-b', realauthorID, tag),
# {})


class AidUSERINPUTLOG(db.Model):
"""Represents a AidUSERINPUTLOG record."""
def __init__(self):
pass
__tablename__ = 'aidUSERINPUTLOG'
id = db.Column(db.BigInteger(15), nullable=False,
primary_key=True,
autoincrement=True)
transactionid = db.Column(db.BigInteger(15), nullable=False,
primary_key=True,
autoincrement=True, index=True)
timestamp = db.Column(db.DateTime, nullable=False,
index=True)
userinfo = db.Column(db.String(255), nullable=False,
index=True)
personid = db.Column(db.BigInteger(15), nullable=False,
primary_key=True,
autoincrement=True, index=True)
action = db.Column(db.String(50), nullable=False,
index=True)
tag = db.Column(db.String(50), nullable=False,
index=True)
value = db.Column(db.String(200), nullable=False,
index=True)
comment = db.Column(db.Text, nullable=True)

class AidVIRTUALAUTHORS(db.Model):
"""Represents a AidVIRTUALAUTHORS record."""
def __init__(self):
pass
__tablename__ = 'aidVIRTUALAUTHORS'
id = db.Column(db.BigInteger(15), nullable=False,
primary_key=True,
autoincrement=True)
virtualauthorID = db.Column(db.BigInteger(15),
db.ForeignKey(AidAUTHORNAMES.id),
nullable=False, index=True)
authornamesID = db.Column(db.BigInteger(15), nullable=False,
index=True)
p = db.Column(db.Float, nullable=False)
clusterID = db.Column(db.BigInteger(15), nullable=False,
server_default='0',
index=True)

class AidVIRTUALAUTHORSCLUSTERS(db.Model):
"""Represents a AidVIRTUALAUTHORSCLUSTERS record."""
def __init__(self):
pass
__tablename__ = 'aidVIRTUALAUTHORSCLUSTERS'
id = db.Column(db.Integer(15), nullable=False,
primary_key=True,
autoincrement=True)
cluster_name = db.Column(db.String(60), nullable=False)

class AidVIRTUALAUTHORSDATA(db.Model):
"""Represents a AidVIRTUALAUTHORSDATA record."""
def __init__(self):
pass
__tablename__ = 'aidVIRTUALAUTHORSDATA'
id = db.Column(db.BigInteger(15), nullable=False,
primary_key=True,
autoincrement=True)
virtualauthorID = db.Column(db.BigInteger(15),
db.ForeignKey(AidVIRTUALAUTHORS.id),
nullable=False, index=True)
tag = db.Column(db.String(255), nullable=False,
index=True)
value = db.Column(db.String(255), nullable=False,
index=True)

class AidREALAUTHORS(db.Model):
"""Represents a AidREALAUTHORS record."""
def __init__(self):
pass
__tablename__ = 'aidREALAUTHORS'
id = db.Column(db.BigInteger(15), nullable=False,
primary_key=True,
autoincrement=True)
realauthorID = db.Column(db.BigInteger(15), nullable=False,
index=True)
virtualauthorID = db.Column(db.BigInteger(15),
db.ForeignKey(AidVIRTUALAUTHORS.id),
nullable=False, index=True)
p = db.Column(db.Float, nullable=False)


1 change: 1 addition & 0 deletions modules/bibcirculation/lib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pylib_DATA = bibcirculation.py \
bibcirculation_dblayer.py \
bibcirculation_config.py \
bibcirculation_daemon.py \
bibcirculation_model.py \
bibcirculation_utils.py \
bibcirculation_cern_ldap.py \
bibcirculation_regression_tests.py
Expand Down
Loading

0 comments on commit 3880f2e

Please sign in to comment.