Changelog
=========
-v0.9.8
+v0.10.0
------
* improve sql queries
* support for bulk operations (MOVE/COPY/DELETE)
# Package requirements
INSTALL_REQUIRES = [
- 'snf-common>=0.9.0rc',
- 'snf-pithos-backend>=0.9.1',
+ 'snf-common>0.9.13',
+ 'snf-pithos-backend>0.9.7',
'Django>=1.2, <1.3'
]
Changelog
=========
-v0.9.8
-------
+v0.10.0
+-------
* New migration tool added, `pithos-migrate`.
$ pithos-migrate upgrade head
- To enable migrations for a new database, create database schema as usual
- and then::
+ To initialize the database and then::
- $ pithos-migrate stamp head
+ $ pithos-migrate initdb
v0.9.7
recursive-include pithos *.json *.html *.json *.xml *.txt
-recursive-include pithos/ui/static *
+recursive-include pithos/backends/lib/sqlalchemy/alembic *
include README Changelog
include distribute_setup.py
# the 'revision' command, regardless of autogenerate
# revision_environment = false
-sqlalchemy.url = driver://user:pass@localhost/dbname
+# sqlalchemy.url = driver://user:pass@localhost/dbname
# Logging configuration
[loggers]
from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
-from synnefo.settings import PITHOS_BACKEND_DB_CONNECTION
+
+try:
+ # pithos-app case
+ from synnefo.settings import PITHOS_BACKEND_DB_CONNECTION
+except ImportError:
+ try:
+ # plankton case
+ from synnefo.settings import BACKEND_DB_CONNECTION as \
+ PITHOS_BACKEND_DB_CONNECTION
+ except ImportError:
+ PITHOS_BACKEND_DB_CONNECTION = None
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
from pithos.backends.lib import sqlalchemy as sqlalchemy_backend
from pithos.backends.lib.sqlalchemy import node, groups, public, xfeatures
+try:
+ # pithos-app case
+ from synnefo.settings import PITHOS_BACKEND_DB_CONNECTION
+except ImportError:
+ try:
+ # plankton case
+ from synnefo.settings import BACKEND_DB_CONNECTION as \
+ PITHOS_BACKEND_DB_CONNECTION
+ except ImportError:
+ PITHOS_BACKEND_DB_CONNECTION = None
+
import sqlalchemy as sa
DEFAULT_ALEMBIC_INI_PATH = os.path.join(
os.path.abspath(os.path.dirname(sqlalchemy_backend.__file__)),
'alembic.ini')
+
def initialize_db():
alembic_cfg = Config(DEFAULT_ALEMBIC_INI_PATH)
+
+ db = alembic_cfg.get_main_option("sqlalchemy.url", PITHOS_BACKEND_DB_CONNECTION)
+ alembic_cfg.set_main_option("sqlalchemy.url", db)
+
engine = sa.engine_from_config(
- alembic_cfg.get_section(alembic_cfg.config_ini_section), prefix='sqlalchemy.')
+ alembic_cfg.get_section(alembic_cfg.config_ini_section),
+ prefix='sqlalchemy.')
+
node.create_tables(engine)
groups.create_tables(engine)
public.create_tables(engine)
xfeatures.create_tables(engine)
-
+
# then, load the Alembic configuration and generate the
# version table, "stamping" it with the most recent rev:
command.stamp(alembic_cfg, "head")
def main(argv=None, **kwargs):
if not argv:
argv = sys.argv
-
+
# clean up args
argv.pop(0)
-
- if argv[0] == 'initdb':
+
+ if len(argv) >= 1 and argv[0] == 'initdb':
+ print "Initializing db."
initialize_db()
- return
+ print "DB initialized."
+ exit(1)
+
# default config arg, if not already set
if not '-c' in argv:
# Package requirements
INSTALL_REQUIRES = [
- 'snf-common>=0.9.0rc',
+ 'snf-common>0.9.13',
'SQLAlchemy==0.6.3',
'alembic>=0.3.4, <0.4',
]
# Provided as an attribute, so you can append to these instead
# of replicating them:
-standard_exclude = ["*.py", "*.pyc", "*$py.class", "*~", ".*", "*.bak"]
+standard_exclude = ["*.pyc", "*$py.class", "*~", ".*", "*.bak"]
standard_exclude_directories = [
".*", "CVS", "_darcs", "./build", "./dist", "EGG-INFO", "*.egg-info", "snf-0.7"
]
namespace_packages = ['pithos'],
packages = PACKAGES,
package_dir= {'': PACKAGES_ROOT},
+ package_data=find_package_data("."),
include_package_data = True,
- package_data = find_package_data('.'),
zip_safe = False,
dependency_links = [
# Package requirements
INSTALL_REQUIRES = [
- 'snf-common>=0.9.0rc',
+ 'snf-common>0.9.13',
'progress>=1.0'
]