unicode

unicode

<%flags>inherit='document_base.myt'</%flags>
<%attr>title='The Types System'</%attr>

<&|doclib.myt:item, name="types", description="The Types System" &>

The package sqlalchemy.types defines the datatype identifiers which may be used when defining <&formatting.myt:link, path="metadata", text="table metadata"&>.  This package includes a set of generic types, a set of SQL-specific subclasses of those types, and a small extension system used by specific database connectors to adapt these generic types into database-specific type objects.

<&|doclib.myt:item, name="standard", description="Built-in Types" &>

SQLAlchemy comes with a set of standard generic datatypes, which are defined as classes.  They are specified to table meta data using either the class itself, or an instance of the class.  Creating an instance of the class allows you to specify parameters for the type, such as string length, numerical precision, etc.

The standard set of generic types are:

<&|formatting.myt:code&>
	# sqlalchemy.types package:
	class String(TypeEngine):
	    def __init__(self, length=None)

	class Integer(TypeEngine)

	class Numeric(TypeEngine):
	    def __init__(self, precision=10, length=2)

	class Float(TypeEngine):
	    def __init__(self, precision=10)

	class DateTime(TypeEngine)

	class Binary(TypeEngine):
	    def __init__(self, length=None)

	class Boolean(TypeEngine)

	# converts unicode strings to raw bytes
	# as bind params, raw bytes to unicode as
	# rowset values
	class Unicode(String)
</&>

More specific subclasses of these types are available, to allow finer grained control over types:

<&|formatting.myt:code&>
class FLOAT(Numeric)
class TEXT(String)
class DECIMAL(Numeric)
class INT(Integer)
INTEGER = INT
class TIMESTAMP(DateTime)
class DATETIME(DateTime)
class CLOB(String)
class VARCHAR(String)
class CHAR(String)
class BLOB(Binary)
class BOOLEAN(Boolean)
</&>

When using a specific database engine, these types are adapted even further via a set of database-specific subclasses defined by the database engine.

</&>

<&|doclib.myt:item, name="custom", description="Creating your Own Types" &>

Types also support pre-processing of query parameters as well as post-processing of result set data.  You can make your own classes to perform these operations.  They are specified by subclassing the desired type class as well as the special mixin TypeDecorator, which manages the adaptation of the underlying type to a database-specific type:

<&|formatting.myt:code&>
    import sqlalchemy.types as types

    class MyType(types.TypeDecorator, types.String):
        """basic type that decorates String, prefixes values with "PREFIX:" on
        the way in and strips it off on the way out."""
        def convert_bind_param(self, value, engine):
            return "PREFIX:" + value
        def convert_result_value(self, value, engine):
            return value[7:]
</&>

Another example, which illustrates a fully defined datatype.  This just overrides the base type class TypeEngine:

<&|formatting.myt:code&>
    import sqlalchemy.types as types

    class MyType(types.TypeEngine):
        def __init__(self, precision = 8):
            self.precision = precision
        def get_col_spec(self):
            return "MYTYPE(%s)" % self.precision
        def convert_bind_param(self, value, engine):
            return value
        def convert_result_value(self, value, engine):
            return value
        def adapt(self, typeobj):
            """produces an adaptation of this object given a type which is a subclass of this object"""
            return typeobj(self.precision)
        def adapt_args(self):
            """allows for the adaptation of this TypeEngine object into a new kind of type depending on its arguments."""
            return self
</&>
</&>
</&>

<%flags>inherit='document_base.myt'</%flags>
<%attr>title='The Types System'</%attr>

<&|doclib.myt:item, name="types", description="The Types System" &>

The package sqlalchemy.types defines the datatype identifiers which may be used when defining <&formatting.myt:link, path="metadata", text="table metadata"&>.  This package includes a set of generic types, a set of SQL-specific subclasses of those types, and a small extension system used by specific database connectors to adapt these generic types into database-specific type objects.

<&|doclib.myt:item, name="standard", description="Built-in Types" &>

SQLAlchemy comes with a set of standard generic datatypes, which are defined as classes.  They are specified to table meta data using either the class itself, or an instance of the class.  Creating an instance of the class allows you to specify parameters for the type, such as string length, numerical precision, etc.

The standard set of generic types are:

<&|formatting.myt:code&>
# sqlalchemy.types package:
class String(TypeEngine):
    def __init__(self, length=None)

class Integer(TypeEngine)

class Numeric(TypeEngine):
    def __init__(self, precision=10, length=2)

class Float(TypeEngine):
    def __init__(self, precision=10)

class DateTime(TypeEngine)

class Binary(TypeEngine):
    def __init__(self, length=None)

class Boolean(TypeEngine)
</&>

More specific subclasses of these types are available, to allow finer grained control over types:

<&|formatting.myt:code&>
class FLOAT(Numeric)
class TEXT(String)
class DECIMAL(Numeric)
class INT(Integer)
INTEGER = INT
class TIMESTAMP(DateTime)
class DATETIME(DateTime)
class CLOB(String)
class VARCHAR(String)
class CHAR(String)
class BLOB(Binary)
class BOOLEAN(Boolean)
</&>

When using a specific database engine, these types are adapted even further via a set of database-specific subclasses defined by the database engine.

</&>

<&|doclib.myt:item, name="custom", description="Creating your Own Types" &>

Types also support pre-processing of query parameters as well as post-processing of result set data.  You can make your own classes to perform these operations.  They are specified by subclassing the desired type class as well as the special mixin TypeDecorator, which manages the adaptation of the underlying type to a database-specific type:

<&|formatting.myt:code&>
    import sqlalchemy.types as types

    class MyType(types.TypeDecorator, types.String):
        """basic type that decorates String, prefixes values with "PREFIX:" on
        the way in and strips it off on the way out."""
        def convert_bind_param(self, value, engine):
            return "PREFIX:" + value
        def convert_result_value(self, value, engine):
            return value[7:]
</&>

Another example, which illustrates a fully defined datatype.  This just overrides the base type class TypeEngine:

<&|formatting.myt:code&>
    import sqlalchemy.types as types

    class MyType(types.TypeEngine):
        def __init__(self, precision = 8):
            self.precision = precision
        def get_col_spec(self):
            return "MYTYPE(%s)" % self.precision
        def convert_bind_param(self, value, engine):
            return value
        def convert_result_value(self, value, engine):
            return value
        def adapt(self, typeobj):
            """produces an adaptation of this object given a type which is a subclass of this object"""
            return typeobj(self.precision)
        def adapt_args(self):
            """allows for the adaptation of this TypeEngine object into a new kind of type depending on its arguments."""
            return self
</&>
</&>
</&>


fixed default example

fixed default example

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/bootandy/sqlalchemy.git/'


docs

docs

git-svn-id: 655ff90ec95d1eeadb1ee4bb9db742a3c015d499@34 8cd8332f-0806-0410-a4b6-96f4b9520244

error: pathspec 'doc/build/components/index.myt' did not match any file(s) known to git


docs

docs

git-svn-id: 655ff90ec95d1eeadb1ee4bb9db742a3c015d499@33 8cd8332f-0806-0410-a4b6-96f4b9520244

<%python scope="global">
	import string, re, time

</%python>

<%args>
	comp
	toc
	title
	version = None
	last_updated = None
	index
	paged
	onepage
	isdynamic
	ext
</%args>

<link href="docs.css" rel="stylesheet" type="text/css"></link>

<% title %>

% if version is not None:

Version: <% version %>   Last Updated: <% time.strftime('%x %X', time.localtime(last_updated)) %>

%

<& printsection.myt, paged = paged, toc = toc, comp = comp, isdynamic=isdynamic, index=index, ext=ext,onepage=onepage &>

error: pathspec 'doc/build/components/section_wrapper.myt' did not match any file(s) known to git


docs

docs

git-svn-id: 655ff90ec95d1eeadb1ee4bb9db742a3c015d499@46 8cd8332f-0806-0410-a4b6-96f4b9520244

<%doc>formatting.myt - library of HTML formatting functions to operate on a TOCElement tree</%doc>

<%global>
	import string, re
	import highlight
</%global>

<%def printtocelement>
<%doc>prints a TOCElement as a table of contents item and prints its immediate child items</%doc>
	<%args>
		item
		includefile
		bold = False
		full = False
		children = True
	</%args>

		<A style="<% bold and "font-weight:bold;" or "" %>" href="<% item.get_link(includefile, anchor = (not includefile)) %>"><% item.description %>

% if children:

% 	for i in item.children:
		<& printsmtocelem, item=i, includefile = includefile, children=full &>
%

%
</%def>

<%def printsmtocelem>
	<%args>
		item
		includefile
		children = False
	</%args>

	<A href="<% item.get_link(includefile) %>"><% item.description %>

% if children:
% 	for i in item.children:
		<& printsmtocelem, item = i, includefile = includefile &>
%
%

</%def>

<%method printtoc>
<%args>
	root
	includefile
	current = None
	full = False
	children = True
</%args>

% header = False
% for i in root.children:

%	if i.header:
%		if header:

%
%	header = True
	<% i.header %>

%
	<& printtocelement, item=i, includefile = includefile, bold = (i == current and includefile), full = full, children=children &>
%

%	if header:

%
</%method>

<%method printitem>
<%doc>prints the description and contents of a TOC element and recursively prints its child items</%doc>

<%args>
	item
	indentlevel = 0
	includefile
	omitheader = False
	root = None
</%args>

% if root is None: root = item

% if not omitheader:
<A name="<% item.path %>">
%

<div class="subsection" style="margin-left:<% repr(10 + indentlevel * 10) %>px;">

% if not omitheader:
	<% item.description %>
%

<%python>
	regexp = re.compile(r"__FORMAT:LINK{(.*?)(?:\|(.*?))?}")
	def link(matchobj):
		path = matchobj.group(1)
		if matchobj.lastindex >= 2:
			xtra = matchobj.group(2)
		else:
			xtra = None

		try:
			element = item.lookup(path)
			if xtra is not None:
				return '%s' % (element.get_link(includefile), xtra, xtra)
			else:
				return '%s' % (element.get_link(includefile), element.description)
		except KeyError:
			if xtra is not None:
				return '%s' % (xtra)
			else:
				return '%s' % path

	m.write(regexp.sub(link, item.content))
</%python>

%	for i in item.children:
		<& printitem, item=i, indentlevel=indentlevel + 1, includefile = includefile, root=root &>
%

% if root is not None and len(item.children) == 0:
	<a href="#<% root.path %>" class="toclink">back to section top
%

% if indentlevel == 0:
%	if includefile:
	<& SELF:pagenav, item=item, includefile=includefile &>
%	else:

% #
%

</%method>

<%method pagenav>
<%args>
	item
	includefile
</%args>

% if not includefile:
	Top |
%

%       if item.previous is not None:
        Previous: <& SELF:itemlink, item=item.previous, includefile = includefile &>
%       # end if

%       if item.next is not None:
%               if item.previous is not None:
                |
%               # end if

        Next: <& SELF:itemlink, item=item.next, includefile = includefile &>
%       # end if

</%method>

<%method itemlink trim="both">
	<%args>
	item
	includefile
	</%args>
	<a href="<% item.get_link(includefile, anchor = (not includefile)) %>"><% item.description %>
</%method>

<%method paramtable>

	<% m.content() %>

</%method>

<%method param>
        <%args>
        name
        classname
        type
	users = 'all'
        default = None
	version = None
        </%args>
% if default is None: default = 'None'

<&|SELF:fliprow, flip=True &>

	<A name="<% m.comp('doclib.myt:current').path %>_<% name %>">
	<% name %> (<% type %>)

% if users is not None:
		for users: <% users %>

%
		default: <% default %>

		used by: <% classname %>
% if version:

since version: <% version %>
%

</&>

<&|SELF:fliprow, flip=False &>

<% m.content() %>

</&>

</%method>

<%method function_doc>
	<%args>
		name = ""
		alt = None
		arglist = []
		rettype = None
	</%args>
	<&|SELF:fliprow, flip=True&>

	<A name="<% m.comp('doclib.myt:current').path %>_<% name %>">
	<% name %>(<% string.join(map(lambda k: "%s" % k, arglist), ", ")%>)

	</&>
	<&|SELF:fliprow, flip=False&>

<% m.content() %>
%	if alt is not None:

Also called as: <% alt %>
%

	</&>
</%method>

<%method member_doc>
	<%args>
		name = ""
		type = None
	</%args>
	<&|SELF:fliprow, flip=True&>

	<A name="<% m.comp('doclib.myt:current').path %>_<% name %>">
	<% name %>

	</&>
	<&|SELF:fliprow, flip=False&>

<% m.content() %>

	</&>
</%method>

<%method fliprow trim="both">
	<%args>flip=True</%args>
	<%python>
		flipper = m.get_attribute("formatflipper")
		if flipper is None:
			flipper = Value("light")
			m.set_attribute("formatflipper", flipper)
	</%python>

% if flip: flipper({"light":"dark", "dark": "light"}[flipper()])
	<tr class="<% flipper() %>"><% m.content() %>

</%method>

<%method codeline trim="both">
<% m.content() %>
</%method>

<%method code autoflush=False>
<%args>
	title = None
	syntaxtype = 'myghty'
</%args>

<%init>
	def fix_indent(f):
		f =string.expandtabs(f, 4)
		g = ''
		lines = string.split(f, "\n")
		whitespace = None
		for line in lines:
			if whitespace is None:
				match = re.match(r"^([ ]+)", line)
				if match is not None:
					whitespace = match.group(1)

			if whitespace is not None:
				line = re.sub(r"^%s" % whitespace, "", line)

			if whitespace is not None or re.search(r"\w", line) is not None:
				g += (line + "\n")

		return g.rstrip()

	content = highlight.highlight(fix_indent(m.content()), syntaxtype = syntaxtype)

</%init>

% if title is not None:

<% title %>

%

<% content %>

</%method>

<%method link trim="both">
	<%args>
		path = None
		param = None
		method = None
		member = None
	</%args>
	<%init>
		if path is None:
			path = m.comp('doclib.myt:current').path

		extra = (param or method or member)
	</%init>
__FORMAT:LINK{<%path%><% extra and "|" + extra or "" %>}
</%method>

error: pathspec 'doc/build/components/formatting.myt' did not match any file(s) known to git


module fix

module fix


fixed assocaition example

fixed assocaition example


would help to have the files all checked in....