1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
Sqledit - the standalone program to browse and edit data
— sqlkit v0.9.5 documentation</title>
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/sqlkit.css" type="text/css" />
<link rel="stylesheet" href="../_static/print.css" type="text/css" media="print" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="top" title="sqlkit v0.9.5 documentation" href="../index.html" />
<link rel="up" title="Mailing list" href="tutorials.html" />
<link rel="next" title="Sqlkit & Sqledit" href="tour.html" />
<link rel="prev" title="Sqledit Tutorial" href="tutorial.html" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '0.9.5',
COLLAPSE_MODINDEX: false,
FILE_SUFFIX: '.html'
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<!-- <link rel="stylesheet" href="http://www.myjqueryplugins.com/plugins/jmenu/demo/jquery/jMenu.jquery.css" type="text/css" /> -->
<link rel="stylesheet" href="../_static/jMenu.jquery.css" type="text/css" />
<script type="text/javascript" src="http://www.myjqueryplugins.com/plugins/jmenu/demo/jquery/jquery.js"></script>
<script type="text/javascript" src="http://www.myjqueryplugins.com/plugins/jmenu/demo/jquery/jquery-ui.js"></script>
<!-- <script type="text/javascript" src="http://www.myjqueryplugins.com/plugins/jmenu/demo/jquery/jMenu.jquery.js"></script> -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-18221996-2']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<script type="text/javascript" src="../_static/jMenu.jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#jMenu").jMenu({
ulWidth : '150',
effects : {
effectSpeedOpen : 300,
effectSpeedClose : 300,
effectTypeOpen : 'slide',
effectTypeClose : 'slide',
effectOpen : 'linear',
effectClose : 'linear'
},
TimeBeforeOpening : 100,
TimeBeforeClosing : 400,
animatedText : false,
paddingLeft: 1 });
})
</script>
<!-- Preview -->
<script type="text/javascript" src="../_static/imgpreview.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('.preview').imgPreview();
});
</script>
<link rel="stylesheet" href="../_static/tour.css" type="text/css" media="screen" />
<!--[if !IE 7]>
<style type="text/css">
#wrap {display:table;height:100%}
</style>
<![endif]-->
</head>
<body>
<div id="wrap">
<div id="header">
<div class="logo"><a href="tour.html">
<img src="../_static/sqlkit.png" align="left" alt="Logo" border="0"/></a>
</div>
<div id="description">Acces to db made easy</div>
</div>
<div style="clear:left;"></div>
<div >
<ul id="jMenu">
<li><a class="fNiv" href="../index.html" title="Home"
>Home</a></li>
<li><a li class="fNiv" href="../sqlkit/contents.html"
title="Sqlkit - the python package"
>Sqlkit</a>
<ul>
<li ><a href="../sqlkit/contents.html"
title="Sqlkit - the python package"
>Sqlkit</a></li>
<li ><a href="../sqlkit/sqlwidget.html" title="Widgets"
>Widgets</a>
<ul>
<li ><a href="../sqlkit/mask.html" title="Mask"
>Mask view</a></li>
<li ><a href="../sqlkit/table.html" title="Table"
>Table view</a></li>
</ul>
</li>
<li ><a href="../sqlkit/browsing.html" title="Browsing Data"
>Browsing data</a>
<ul>
<li ><a href="../sqlkit/constraints.html" title="Constraints"
>Constraints</a></li>
<li ><a href="../sqlkit/filters.html" title="Filters"
>Filters</a></li>
<li ><a href="../sqlkit/totals.html" title="Totals"
>Totals</a></li>
</ul>
</li>
<li ><a href="../sqlkit/editing.html" title="Editing Data"
>Editing data</a>
<ul>
<li ><a href="../sqlkit/completion.html" title="Completion"
>Completion</a></li>
<li ><a href="../sqlkit/validation.html" title="Validation"
>Validation</a></li>
<li ><a href="../sqlkit/relationship.html" title="Relationships"
>Relationships</a></li>
</ul>
</li>
<li ><a href="../sqlkit/printing.html" title="Printing"
><span>Printing</span></a></li>
<li ><a href="../sqlkit/advanced/contents.html" title="Advanced configuration"
>Advanced configuration</a>
<ul>
<li ><a href="../sqlkit/advanced/fields.html" title="Fields"
>Fields</a></li>
<li ><a href="../sqlkit/advanced/views.html" title="Views"
>Views</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="fNiv" href="#"
title="Sqledit GUI"
>Sqledit GUI</a></li>
<li><a class="fNiv" href="tutorials.html"
title="Support & tutorials"
>Support & Tutorials</a>
<ul>
<li ><a href="#"
title="Sqledit - the application"
>Sqledit - the application</a></li>
<li ><a href="tour.html"
title="Sqlkit - the features'tour"
>Sqlkit - features' tour</a></li>
<li ><a href="#"
title="Sqledit - the application"
>Installing instructions</a></li>
</ul>
</li>
<li><a class="fNiv" href="../layout/contents.html" title="Layout"
>Layout</a></li>
<li><a class="fNiv"href="contents.html" title="Download"
>Download</a>
<ul>
<li ><a href="contents.html"
title="Download"
>Download</a></li>
<li ><a href="http://sqlkit.argolinux.org/download/Changelog" title="Changelog"
title="Changelog"
>Changelog</a></li>
<li ><a href="backward_incompatibilities.html"
title="Backward incompatibilities"
>Backward incompatibilities</a></li>
</ul>
</li>
</ul>
</div>
<div style="clear:left;"></div>
<div class="related">
<ul>
</ul>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<div class="news">
<h2>Release 0.9.5 is out</h2>
I'm happy to announce that on February, 7 2012 I released
<a href="download.html#download">version 0.9.5</a> of
sqlkit that adds support for sqlalchemy 0.7+ as wel as some minor
improvements (see
<a href="/download/Changelog">changelog</a>).
</div>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="sqledit-the-standalone-program-to-browse-and-edit-data">
<span id="sqledit"></span><h1>Sqledit - the standalone program to browse and edit data<a class="headerlink" href="#sqledit-the-standalone-program-to-browse-and-edit-data" title="Permalink to this headline">¶</a></h1>
<p>Sqledit is an application that can be used by anybody without any
programming skill. Basically is just needs a target database that
can be fed throught a GUI or on the command line.</p>
<a class="preview reference external image-reference" href="../_images/sqledit.png"><img align="right" alt="../_images/sqledit.png" class="preview align-right" src="../_images/sqledit.png" style="width: 106.8px; height: 175.2px;" /></a>
<a class="preview reference external image-reference" href="../_images/sqledit_setup.png"><img align="left" alt="../_images/sqledit_setup.png" class="preview align-left" src="../_images/sqledit_setup.png" style="width: 166.8px; height: 137.2px;" /></a>
<p>Sqledit is a data editor/browser. At startup it will present a list of all
tables that can be selected for editing (choosing <a class="reference external" href="../sqlkit/mask.html#mask"><em>SqlMask</em></a> or
<a class="reference external" href="../sqlkit/table.html#table"><em>SqlTable</em></a>) or for introspection.</p>
<p>When run from command line it offers several options:</p>
<div class="highlight-python"><pre>usage: %prog [options] [[url|nick] table]
-u, --url = URL: an url to open (eg postgres://user:pass@host/dbname)
-n, --nick = nick: a nick in ~/.sqledit/nicks
-t, --table = table: open table 'table'
-m, --mask: open a SqlMask (default is SqlTable)
-b, --browser: open the table browser reguardless of nick configuration
-T, --sqltable: open a SqlTable (default when -t is used)
-d, --dev: open in 'dev' mode
-D, --debug: print debug
-g, --gtk-debug: use LogTheMethods
-S, --sql=statement: execute statement (requires -t)
-a, --all-tables: read all table on startup (very slow)
-f, --field_list=fields: comma (or space) separated field list
-o, --order_by=fields: comma separated field list
-c, --configure: open SqlMasq on _sqlkit_table or create it
-v, --version: prin version and exit
-L, --load: load data when opening a table (if no table is directly
opened, set LoadData)
-l, --limit=LIMIT: limit to LIMIT rows
-i, --ipython: if ipython is present it opne an ipython shell
-C, --create-templates=mode: create in one of these modes: layout,
hooks, programm, models, all
, --create-tables: Create all tables in models define in metadata (models.metadata or Base.metadata)</pre>
</div>
<p>If called without argument it will present a connection dialog:</p>
<p>If sqledit can find a demo in your systems, it will give you the chance to
start it. If you want to type the URL of your db you can directly attempt a
connection or disable it via a checkbox on the right of the entry.</p>
<p>The autoconnect mode is really nice but you may experiment hangs till a
connection timeout if you write a wrong host name.</p>
<p>Since database urls are not nice to write, you can store data in a
configuration file and call nick names instead.</p>
<div class="section" id="module-sqlkit.misc.conf">
<h2>.sqledit<a class="headerlink" href="#module-sqlkit.misc.conf" title="Permalink to this headline">¶</a></h2>
<p>You can write configurations in a file in your home called <tt class="docutils literal"><span class="pre">.sqledit/nicks</span></tt> and
start sqledit on that configuration using a nickname:</p>
<div class="highlight-python"><pre>[invitati]
URL = postgres://sandro:xxx@my_host/2giugno
table = partecipazioni_invitato
dev = True
field_list = nome, cognome, and all other fields
order_by = cognome, nome
[brasile]
copy = invitati
field_list = nome, cognome, email, ludo</pre>
</div>
<p>Valid option are URL and any other option for sqledit. The special option
<tt class="docutils literal"><span class="pre">copy</span></tt> force sqledit to read the other definition first and then
overwrite.
In this case ‘brasile’ shares all options with ‘2giugno’ but overwrites
field_list.</p>
<p>Even if you don’t want to program in Python you may want to add
configuration in a more rich way that allowed in <tt class="docutils literal"><span class="pre">.sqledit/nicks</span></tt>. That
can add for example layout information or information on the relations
between tables so that a Mask can present a ecord and data related to it.</p>
<p>Let’s say that that’s a gentle introduction to programming with sqlkit...</p>
<div class="section" id="nick-extended-configuration">
<h3>Nick extended configuration<a class="headerlink" href="#nick-extended-configuration" title="Permalink to this headline">¶</a></h3>
<p>Sqledit configuration may be extended beyond <tt class="docutils literal"><span class="pre">.sqledit/nicks</span></tt> file.
You can add configurations for a nick in a subdirectory of <tt class="docutils literal"><span class="pre">.sqledit</span></tt>
named as the nick itself. Hooks, layout, or a program can be placed directly
hereq. As an example if you have a nick ‘film’ defined in
<tt class="docutils literal"><span class="pre">.sqledit/nicks</span></tt>:</p>
<div class="highlight-python"><pre>[film]
url = 'postgres://localhost/film</pre>
</div>
<p>you can add customizations w/o creating a real program. Currently you can
add:</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">layout.py:</th><td class="field-body"><p class="first">the layout that SqlMask should use when creating the GUI. You can
create an empty template for this with <tt class="docutils literal"><span class="pre">sqledit</span>
<span class="pre">--create-template</span> <span class="pre">layout</span> <span class="pre">nick</span></tt>. That’s the place where you would
register your layout.</p>
<p>This is autoloaded if no <tt class="docutils literal"><span class="pre">program.py</span></tt> is present</p>
</td>
</tr>
<tr class="field"><th class="field-name">hooks.py:</th><td class="field-body"><p class="first">the <a class="reference external" href="../sqlkit/sqlwidget.html#hooks"><em>Hooks</em></a> that will be used as default. You can create an
empty template for this with <tt class="docutils literal"><span class="pre">sqledit</span> <span class="pre">--create-template</span> <span class="pre">hooks</span>
<span class="pre">nick</span></tt>. That’s the place where you would register yout hooks.</p>
<p>This is autoloaded if no <tt class="docutils literal"><span class="pre">program.py</span></tt> is present</p>
</td>
</tr>
<tr class="field"><th class="field-name">models.py:</th><td class="field-body"><p class="first">this file is for definition of the classes. If you define classes here
you can set <a class="reference external" href="../sqlkit/relationship.html#relationships"><em>Relationships</em></a> between them so that a mask can display
parent/child records as director/movies. Many examples in the demo.</p>
<p>This is autoloaded if no <tt class="docutils literal"><span class="pre">program.py</span></tt> is present</p>
<p>You can create an empty template for this with <tt class="docutils literal"><span class="pre">sqledit</span>
<span class="pre">--create-template</span> <span class="pre">models</span> <span class="pre">nick</span></tt></p>
</td>
</tr>
<tr class="field"><th class="field-name">program.py:</th><td class="field-body"><p class="first">a program that will be executed instead of normal sqledit. There
is no particular advantage running this instead of creating a real
standalone program but sometimes it just grows step by step (you start
with a simple nick, than you add a layout, maybe a hook and you need more
customization).</p>
<p>You will call the program as <tt class="docutils literal"><span class="pre">sqledit</span> <span class="pre">film</span></tt> and sqledit will:</p>
<ul class="simple">
<li>cd to ~/.sqledit/film</li>
<li>execfile(‘program.py’, {‘opts’ : opts})</li>
<li>no other file will be autoloaded in this case</li>
</ul>
<p>where <tt class="docutils literal"><span class="pre">opts</span></tt> is a class that holds the options you set in the nick
definition (among which <tt class="docutils literal"><span class="pre">opts.url</span></tt>). You can create an empty template
for this with <tt class="docutils literal"><span class="pre">sqledit</span> <span class="pre">--create-template</span> <span class="pre">hooks</span> <span class="pre">nick</span></tt>.</p>
<p>A second reason is that many times a program that uses sqlkit is a
<em>very</em> short script and I found myself spending more time deciding a
proper name and place, this already makes these decisions for you!</p>
<p class="last">There is no need to start <tt class="docutils literal"><span class="pre">gtk.main()</span></tt> since this is no longer the main
program, sqledit will run it before this moment</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="schema-browser">
<h2>schema browser<a class="headerlink" href="#schema-browser" title="Permalink to this headline">¶</a></h2>
<p>Introspection of the database will give you the possibility to see all
fields of a table showing all fields, with type, primary keys, foreign keys and
indexes. If you configured a nick to jump directly on a table or any other
configuration allowed by sqledit customization, you’ll need the -b
(–browser) option to get to the schema browser.</p>
</div>
<div class="section" id="options">
<h2>Options<a class="headerlink" href="#options" title="Permalink to this headline">¶</a></h2>
<p>Calling <cite>sqledit</cite> from a command line under a Linux system with bash
completion you can benefit from the completion that will look for completion
in the .sqledit/nicks file and will suggest some common url (postgresql://,
sqlite://...)</p>
<p>When primary keys are numeric you probably don’t want/need to see them, you
can switch off the visualization with the <tt class="docutils literal"><span class="pre">primary</span> <span class="pre">key</span></tt> toggle button</p>
<p>The <tt class="docutils literal"><span class="pre">Load</span></tt> toggle button determines if you want to load data when opening a
table.</p>
<p><tt class="docutils literal"><span class="pre">Blank</span></tt> toggle button determines if you want to cast blank string fields to
NULL values. When you decide to cast it you may be prompted several times if
you want to save changes that you are not even aware of.</p>
</div>
<div class="section" id="configuring-sqlkit">
<h2>Configuring sqlkit<a class="headerlink" href="#configuring-sqlkit" title="Permalink to this headline">¶</a></h2>
<img alt="../_images/sqledit_config.png" src="../_images/sqledit_config.png" />
<p>Sqlkit looks for possible configuration options in some tables, that may or
not be present: _sqlkit_table, and _sqlkit_field.</p>
<p>These tables can be edited directly from the database menu, or via
<tt class="docutils literal"><span class="pre"><Ctrl-e></span></tt> shortcut.</p>
<p>Completion will help yo configure the fields. Here is the meaning:</p>
<div class="section" id="table-s-field">
<h3>table’s field<a class="headerlink" href="#table-s-field" title="Permalink to this headline">¶</a></h3>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">name:</th><td class="field-body"><p class="first">the table’s name</p>
</td>
</tr>
<tr class="field"><th class="field-name">search field:</th><td class="field-body"><p class="first">this is the <strong>string</strong> field that will be used when searching
via foreign key. Suppose you are editing a table of movies, and you must
fill in the director’s field. You write some letters and trigger a
completion, that means you want sqlkit to use that text (e.g. “Fel”),
select which directors are present that has that string in... well you
surely want to search in the last name, but you need to tell sqlkit.</p>
<p><em>search_field</em> is here for that.</p>
</td>
</tr>
<tr class="field"><th class="field-name">format:</th><td class="field-body"><p class="first last">ok, you get back from completion a list of directors you still
need to show them in a nice way (e.g. first_name, last_name). Here you
are supposed to used the syntax “%(field_name)s”.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="attributes-fields">
<h3>attributes’fields<a class="headerlink" href="#attributes-fields" title="Permalink to this headline">¶</a></h3>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">name:</th><td class="field-body">the field_name</td>
</tr>
<tr class="field"><th class="field-name">description:</th><td class="field-body">the label you want to be used. (Note that when using
<a class="reference external" href="../sqlkit/relationship.html#relationships"><em>related tables</em></a> you may indicate
relation.field_name)</td>
</tr>
<tr class="field"><th class="field-name">help_text:</th><td class="field-body">this is the tooltip that will be added to the entry</td>
</tr>
<tr class="field"><th class="field-name">autostart:</th><td class="field-body">you can set an <a class="reference external" href="../sqlkit/completion.html#autostart"><em>Autocompletion</em></a> value for the completion</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div> <!-- wrap -->
<div class="bottomnav footer">
<div class="doc_copyright">
Alessandro Dentella -- Copyright 2006-2007-2008-2009-2010
Sqlkit release 0.9.5
<!-- % if hasdoc('copyright'): -->
<!-- © <a href="../copyright.html">Copyright</a> 2008, Sandro Dentella. -->
<!-- % else: -->
<!-- © Copyright 2008, Sandro Dentella. -->
<!-- % endif -->
creato usando <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.4.
</div>
</div>
<br style="clear: left" />
</body>
</html>
|