{ "info": { "author": "Christian Zagrodnick", "author_email": "mail@gocept.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Programming Language :: Python" ], "description": ".. contents::\n\n=========\n tcm2sql\n=========\n\n\nWhat is this?\n=============\n\ntcm2sql is a tool for generating SQL commands from a tcm static\nstructure diagram (SSD). It was developed by Christian Zagrodnick for\ngocept to generate some large PostgreSQL databases out of diagrams.\n\nThis diagram type is normally used for object structures in UML. If you are\nfamilliar with the UML notation, you should get the tcm2sql conventions\nfairly fast into your brain.\n\nRenderers can be plugged in to tcm2sql quite easy. Currently there is only\na renderer for PostgreSQL. It creates PostgreSQL compatible `create table`\nand related queries. The documentation is mostly based on PostgreSQL terms.\nThere is a section which deals with other renderers.\n\nIn prior versions there were also:\n\n * DBObjects -- for creating some code which might be useful if you are using DBObjects.\n\n * Prolog -- for creating Prolog terms.\n\nThose have been removed because of vast changes in tcm2sql's internal API\nand no actualy need for them. If you like to see those or others please\ncontact me.\n\nThere is also a mode for generating the difference between two SSDs. This\nallows to semi automatic updating of databases.\n\nTCM can be obtained from `University of Twente`_. There is versionavailable\non Debian, too.\n\nThanks to Christian Theune for reviewing the documentation.\n\n\nThe conventions\n===============\n\nYou might want to open an `Example*.ssd` in the `doc` directory of this\npackage.\n\n`Double Class Boxes` and `Triple Class Boxes` are used for tables.\nAs in UML the top is for the name, the middle for the attributes. The\nbottom part is used for constraints in tcm2sql.\n\nName\n----\n\nThe name is just passed to the `create table `.\n\nAttributes\n----------\n\nBasically an attribute definition looks like:\n\n\t: \n\ni.e.\n\n\ttitle: varchar(32)\n\nRow constraints are just written after the datatype:\n\n\tname: varchar(64) not null\n\n\nSo far so good. But there also are a few special characters:\n\n\t``#`` -- marks one more more columns as the PRIMARY KEY\n\n\t``~`` -- marks a column as a FOREIGN KEY\n\n\t``-`` -- marks a column as private\n\ni.e.\n\n\t#id: serial\n\ndefines a single row primary key, whereas\n\n\t#~foo: integer\n\n\t#~bar: integer\n\ndefines a double row PRIMARY KEY, while simultaneously marking\nthem as two FOREIGN KEYs.\n\nSo the whole attribute definition looks like this:\n\n ::=\n\t[\"#\"]{0,1}[\"~\"]{0,1}: \n\n\n\nConstraints\n===========\n\nAs stated above, what the operations are in UML, are the\nconstraints in tcm2sql.\n\nConstraints have a similar definition as attributes:\n\n ::= : \n\nFor example:\n\n\tinvalidFoo: check (foo>47)\n\tdupeFooBar: unique (foo,bar)\n\nTo avoid very large boxes in the diagram you also have the\npossibilty to add constraints using the annotation of your table.\nIt then has to be prefixed by an questionmark (?). Since tcm has\nno indicator for boxes which have an annotation you might write\n`` as constraint, which is just ignored and is a good remember for\nyourself.\n\n ::= [[|\"\"]\\n]*\n\n\nRelations\n=========\n\nIn UML there are different types of relations between classes,\nwhich I tried to adapt to PostgreSQL.\n\nImplemented in tcm2sql:\n\n\t* Aggregation (white diamond)\n\n\t\tresults in an `on delete set null`\n\n\t\tThe diamond has to be connected to the table\n\t\twith the referenced PRIMARY KEY.\n\n\t* Composition (black diamond)\n\n\t\tresults in an `on delete cascade on update cascade`\n\n\t\tThe diamond has to be connected to the table\n\t\twith the referenced PRIMARY KEY.\n\n\t* Generalisation (arrow)\n\n\t\tresults in `inherits (foo)` See `PostgreSQL documentation`_ for\n\t\tdetails.\n\n\t\tThe parent table is where the arrow points to.\n\n\t* Binary relationship\n\n\t\tresults in an ordinary relation between two\n\t\ttables.\n\n\t\tYou have to write a 1 on *one* end in the\n\t\tcardinality field. This is where die PK resides.\n\n\nSo what's the ~ for?\n\n\tWithin a table every FOREIGN KEY has to be prefixed with\n\tthe ~. There are two ways for assigning a row to a\n\trelation.\n\n\t1. Write the FK's name as ROLE on the relation.\n\n\t2. Name it _\n\nHow to reference a composite primary key?\n\n Make a single relation between the tables and put the\n names of the foreign keys komma separated into the \"role\n name\" of the foreign key side of the relation.\n\n\nViews and Private Attributes\n============================\n\n For every table a view `sv` is created with only public\n attributes. If you need access to the database with ODBC but cannot\n allow access to all attributes you just mark the private attributes\n with `-` and let ODBC only access the views.\n\n\nThe modes\n=========\n\n\nCreate Mode\n-----------\n\nUsage: bin/tcm2sql -n ...\n\nGenerates a full sql file (actualy it prints to stdout) with the\nnecessary `CREATE TABLE` commands. The constraints are added\nafterwards, since this is much easier.\n\nDiff Mode\n---------\n\nUsage: bin/tcm2sql -o -n ...\n\nGenerates sql wich does the following:\n\n\t- copy data to temporary tables\n\t- drop tables\n\t- create new tables\n\t- drop sequences of deleted tables\n\t- create sequences for new tables\n\t- copy data back\n\n\nThe diff mode seems to work pretty well, but please ensure you\nhave a recent backup.\n\n\nUsing multiple ssd files to create a single database\n====================================================\n\nAs the database grows you get more and more junctions. Furthermore tcm\nallows only six pages which become full. To avoid both problems you can\nsplit your database into several files.\n\nThe file you pass as parameter to tcm2sql is started with. To have a\nconnection to another ssd file you create a class node with a stereotype.\nThe stereotype is the relative (to the master ssd) or absolute file name of\nthe ssd to be included. The table name references the actual table in the\nincluded ssd. See ExampleInclude*.ssd for an expamle.\n\nIt is possible to build include circles and including forth and back\nwithout any problem.\n\n\nExamples\n========\n\nThere are two example ssds, just try tcm2sql on them.\n\nReferences\n==========\n\n.. _`PostgreSQL documentation`: http://www.postgresql.org/idocs/index.php?inherit.html\n\n.. _`University of Twente`: http://wwwhome.cs.utwente.nl/~tcm/\n\n\n\n\n============\n Change log\n============\n\n1.0.0 (2010-12-14)\n==================\n\n - Eggified package.\n\n - Added entry point for console script.\n\n\n0.9.2 (2006-10-18)\n==================\n\n - Restructured renderer classes to make it easier to write\n renderers for other database managenemt systems.\n - Better handling for serials and bigserials: Now they are always\n written as integer with default + creation of sequence. (This\n makes updating of tables possible which have serial columns.)\n - Added commandline option --no_views to not generate views for the tables.\n - Made usage help a bit nicer.\n\n0.9.1 (2005-03-31)\n==================\n\n - Multi column foreign keys\n\n0.9 (2003-09-13)\n================\n\n - splitting database to several diagrams (see README for documentation)\n - requires Python 2.2\n - complete rewrite of ssd file reader\n - large changes on internal data structures\n - code is much more readable\n - DBObjects and Prolog renderer removed; they had to be changed to fit\n into the new structure but there is no need for them right now.\n\n0.04 (2002-08-02)\n=================\n\n - prolog renderer\n - DBObjects renderer (quite useless)\n - fixed the create/drop sequence bug (bug #374)\n - Added logging tables for Postgres\n\n0.03 (2002-03-30)\n=================\n\n\t- Works with python2.1 now\n\t- some minor fixes\n\n\n0.02 (2002-02-13)\n=================\n\n\t- first public release", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://code.gocept.com", "keywords": "sql tcm", "license": "GPL 2", "maintainer": null, "maintainer_email": null, "name": "tcm2sql", "package_url": "https://pypi.org/project/tcm2sql/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/tcm2sql/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://code.gocept.com" }, "release_url": "https://pypi.org/project/tcm2sql/1.0.0/", "requires_dist": null, "requires_python": null, "summary": "Tool for generating SQL commands from a tcm static structure diagram (SSD)", "version": "1.0.0" }, "last_serial": 800391, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "313f2fec25adf343863b698aeb58880c", "sha256": "f6dd5aadde55f925eb39922ecaa2e6384d073e2675c4e027ec2b270ec9426535" }, "downloads": -1, "filename": "tcm2sql-1.0.0.tar.gz", "has_sig": false, "md5_digest": "313f2fec25adf343863b698aeb58880c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 34733, "upload_time": "2010-12-14T11:21:11", "url": "https://files.pythonhosted.org/packages/60/fd/a0438c8d36fec9dd46a868ec3d371f01e4612c6737c20e24689c188c3cdb/tcm2sql-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "313f2fec25adf343863b698aeb58880c", "sha256": "f6dd5aadde55f925eb39922ecaa2e6384d073e2675c4e027ec2b270ec9426535" }, "downloads": -1, "filename": "tcm2sql-1.0.0.tar.gz", "has_sig": false, "md5_digest": "313f2fec25adf343863b698aeb58880c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 34733, "upload_time": "2010-12-14T11:21:11", "url": "https://files.pythonhosted.org/packages/60/fd/a0438c8d36fec9dd46a868ec3d371f01e4612c6737c20e24689c188c3cdb/tcm2sql-1.0.0.tar.gz" } ] }