Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Quick hack to setup the database for docker-registry thats not a sqlite bla blah
import sqlalchemy
import sqlalchemy.exc
import sqlalchemy.ext.declarative
import sqlalchemy.orm
import sqlalchemy.sql.functions
from sqlalchemy import create_engine
engine = create_engine('postgresql://')
Base = sqlalchemy.ext.declarative.declarative_base(bind=engine)
class Version (Base):
"Schema version for the search-index database"
__tablename__ = 'version'
id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True)
def __repr__(self):
return '<{0}(id={1})>'.format(type(self).__name__,
class Repository (Base):
"Repository description"
__tablename__ = 'repository'
id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True)
name = sqlalchemy.Column(
sqlalchemy.String, nullable=False, unique=True)
description = sqlalchemy.Column(sqlalchemy.String)
def __repr__(self):
return "<{0}(name='{1}', description='{2}')>".format(
type(self).__name__,, self.description)

This comment has been minimized.

Copy link
Owner Author

@zircote zircote commented Sep 8, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment