WikiStart » History » Version 39
Eric Worden, 12/22/2016 02:24 PM
README for 2.0.1
1 | 39 | Eric Worden | h1. README File for Simpycity |
---|---|---|---|
2 | 33 | Lacey Powers | |
3 | 39 | Eric Worden | {{toc}} |
4 | 1 | ||
5 | 39 | Eric Worden | h2. What Simpycity Is |
6 | 1 | ||
7 | 39 | Eric Worden | Simpycity is an object-relational mapper. It seamlessly maps PostgreSQL query |
8 | and function result sets to Python classes and class attributes. |
||
9 | 1 | ||
10 | 39 | Eric Worden | It allows for the easy and rapid development of query- and |
11 | stored procedure-based data representations. Simpycity leverages PostgreSQL's |
||
12 | powerful composite type system, and the advanced type handling of the psycopg2 |
||
13 | database access library. |
||
14 | 1 | ||
15 | 39 | Eric Worden | h2. What Simpycity is Not |
16 | 1 | ||
17 | 39 | Eric Worden | Simpycity is not a SQL generator and does not attempt to abstract or hide SQL. |
18 | Simpycity is designed for developers who deeply understand SQL and |
||
19 | desire to write the best possible SQL representations for their database. |
||
20 | Simpycity also rejects the Active Record and Data Mapper paradigms, whose |
||
21 | simplistic patterns fail in even moderately complex systems. |
||
22 | 35 | Aurynn Shaw | |
23 | 39 | Eric Worden | h2. Core Philosophy |
24 | 33 | Lacey Powers | |
25 | 39 | Eric Worden | The core philosophy behind Simpycity is that the Database and the Application |
26 | are separate entities, each with distinct abilities and design |
||
27 | representations; this echoes the classic Object versus Relation argument. |
||
28 | It provides a mechanism where a single business Object can easily represent |
||
29 | several Relations, and allow the base Relational layer to follow normal forms |
||
30 | without compromising or complicating application design. |
||
31 | 1 | ||
32 | 39 | Eric Worden | h2. Usage |
33 | 37 | Aurynn Shaw | |
34 | 39 | Eric Worden | At its simplest, object-relation mapping looks like:: |
35 | 36 | Aurynn Shaw | <pre> |
36 | 39 | Eric Worden | --SQL |
37 | create table foo (id int, name text); |
||
38 | insert into foo (id, name) values (1, 'one'), (2, 'two'); |
||
39 | 5 | Aurynn Shaw | |
40 | 39 | Eric Worden | #Python |
41 | class Foo(simpycity.model.SimpleModel): |
||
42 | pg_type = ('public', 'foo') |
||
43 | __load__ = simpycity.core.QuerySingle('foo',['id']) |
||
44 | 33 | Lacey Powers | |
45 | 39 | Eric Worden | my_foo = Foo(1) |
46 | print(my_foo.name) |
||
47 | >>>one |
||
48 | 1 | </pre> |
|
49 | |||
50 | 39 | Eric Worden | Read the [[AQuickTutorial|tutorial]] for more narrative help. |
51 | 1 | ||
52 | 39 | Eric Worden | h2. License |
53 | 1 | ||
54 | 39 | Eric Worden | Simpycity is licensed under the LGPL license, and a copy of your rights and |
55 | permissions is available in the LICENSE file included in your distribution. |
||
56 | 1 | ||
57 | 39 | Eric Worden | h2. Contact |
58 | 1 | ||
59 | 39 | Eric Worden | The official source repository is https://github.com/commandprompt/Simpycity |
60 | 1 | ||
61 | 39 | Eric Worden | For support, questions, and additional help with Simpycity, please feel free |
62 | to contact us on github. |