Posts

Showing posts with the label databases

adodbapi 2.3.0 (the django version) released

Vernon Cole has announced the release of a new version of adodbapi, a Windows database driver that works with both CPython and IronPython.   This version is all about django support.  There are two targets:     A) MS SQL database connections for mainstream django.     B) running django on IronPython    Thanks to Adam Vandenberg for the django modifications. adodbapi home page on sourceforge A Python DB-API 2.0 module that makes it easy to use Microsoft ADO for connecting with databases and other data sources using either CPython or IronPython. This version is highly refactored following the work of Adam Vandenberg, and also has all of the current user suggested patches. Both the Mercurial tree and the downloadable zip files are updated.  (There is no fancy installer, just copy the folder in your site-packages folder.) This has been tested using CPython 2.3, CPython 2.6, IronPython 2.6 (.NET 2) and IronPython 2.6(.NET 4...

A Good Mix 28: NTornado, WPF, Testing in Italian, More Benchmarking, and adodbapi

Yet another collection of IronPython and DLR related articles, projects and blog entries from the past few weeks. NTornado NTornado is an IronPython version of the Tornando web server. The Tornado Web Server is the open source version of the non-blocking web server that power FriendFeed and now part of the Facebook's open source initiative. This server is coded in Python and with strong emphasis on operating systems with epoll support. NTornado is a port of Tornado to IronPython using asynchronous high-performance sockets in .NET. To run the demos (requires IronPython 2.6): > ipy -X:Frames "demo file name".py Getting WPF Control Template in IronPython I always find myself needing a control template so I can customize one of the WPF controls. I used to fire up Expression Blend to get it, and then realized I could write a little IronPython code to do it. Paste this code into the IronPython 2.0 or 2.6 console to see it work! Modulo .NET test con IronPython  A tr...

A Good Mix 13: ActiveRecord, Guids and Strings (etc)

Another selection of IronPython snippets and articles from around the web. IronPython ActiveRecord in Action The Active Record pattern is a pattern for working with databases named by Martin Fowler and popularised by Rails: " The interface to such an object would include functions such as Insert, Update, and Delete, plus properties that correspond more-or-less directly to the columns in the underlying database table. " Creating classes where the shape of the class corresponds to the shape of a database table is particularly easy with dynamic languages. This Chinese blog entry demonstrates the pattern with IronPython hosted in C#. Generating Strong Repeatable Guids Blog entries by Steve Gilham have made frequent appearances here on IronPython-URLs, although I believe it has been a while since the last one. This entry isn't specifically about IronPython - but the example code is in IronPython. He shows a couple of example functions he uses in his build scripts to solve th...

Running KirbyBase in IronPython

KirbyBase has a small but warm place in my heart as the first database I ever used in an application. It is a pure-Python single module database that stores its data in plain-text delimited files and has a Pythonic query syntax. Sure you don't want to run a high volume website with it but it is fun to use and experiment with. Krishna Bhargav has been using it from IronPython and has written up a blog entry on how to get it working with IronPython 2.6: Running KirbyBase in IronPython As I was looking for embedded database systems, I came across this pure python database called KirbyBase. So I decided that I would make it run on IronPython. So this post describes on how to make KirbyBase run on IronPython and using ipy.exe. Note that I am not looking at integrating this database into C# application yet. [may be in the future post] Using Python libraries from C# is an interesting topic (covered briefly in IronPython in Action of course) which I don't think enough people have exp...

A Good Mix 6: Databases, the DLR and Programming Languages

Another selection of blog entries and articles on IronPython culled from the last few weeks. FBConsole 0.8.2 Released I last reported on FBConsole in August 2007, when version 0.7.2 was released . FBConsole is a "Firebird RDBMS Tool Powered by IronPython" (a Python console for the Firebird database ). This new release ( via ) is built with IronPython 2.0. Configuring the DLR for IronPython and IronRuby Another blog entry in Japanese. It is useful though as it shows you the ScriptRuntime configuration ( app.config ) needed for hosting both IronPython and IronRuby in a single application. Useful if you are using the DLR to provide user scripting and want to give your users a choice of languages to use. Cobra Programming Language April Update Another update, with accompanying release , for the Cobra Programming Language . Cobra is a .NET programming language with both dynamic and static binding, a Python inspired syntax and first class support for unit tests and contracts. As...

A Good Mix 5: Cookbook entries, ADODBAPI and IronPython with Asterisk

Only the finest selection of articles and blog posts on IronPython and related topics. Connection String Editor A recipe in the IronPython Cookbook showing how you can prompt the user for a connection string (for connecting to databases) using a built-in connection string editor dialog box from the Microsoft .NET Framework. IPY as AMI client thru AMIConnector A blog entry demonstrating the power of the interactive interpreter for exploring new libraries. This entry investigates AmiConnector , which is a .NET library for working with the Asterisk Manager. Kudos to Vernon Cole Dave Fugate, IronPython testing and infrastructure guy, pays homage to Vernon Cole for pywin32's adodbapi which runs under both CPython and IronPython. The tests have now been added to the IronPython test infrastructure so that the IronPython team will get early warning if they break it. Dave comments " Now I just need to setup Northwind databases on 40+ test machines... ". Self-executable scripts A...

Entity Framework Profiler Hosts IronRuby and IronPython

The Entity Framework is a Microsoft ORM framework for .NET. It is included in .NET 3.5 SP1. The Entity Framework Profiler is a tool for analysing, logging and profiling the SQL queries made by the Entity Framework. Based on the work done by Ben Hall in his IDE for DLR languages, IronEditor , Simon Segal has added " scripting into the profiler so users could compose scripts and execute Entity Framework code directly from the Profiler itself ". Entity Framework Profiler hosts IronRuby and IronPython Both IronPython and IronRuby scripting works, and there is lots of example code in the blog entry.

Writing to Freebase with IronPython

Freebase is "A social database about things you know and love". It has a public API to access and update structured data. The API is based on the Metaweb Query Language (MQL) and naturally there are Python bindings to the API. The API Guy has a blog entry about writing to Freebase using IronPython, including code samples: Writing to Freebase with IronPython My mom was in town visiting this weekend, and when I went to demo Freebase for her, I asked her to name a famous person. She suggested Pope John Paul II , so we looked him up. Most of the information that you would expect Freebase to know about him, it did. But there was one glaring omission: it didn’t know that he was Catholic. Since Freebase knows 263 people who have ever been a professional Pope , I decided that it would take a little too long to update them each by hand. And so I set out to scribble up a few lines of Python to use the Freebase API libs for Python. In order to use the Freebase Python lib from IronPyt...

Venturing into IronPython: SQLite and IronPython Studio

Mark Garringer has been venturing into IronPython and posted a couple of blog entries on his experiences. Mark has been trying to learn Python for a while, and as he is a .NET programmer he found it easier to get into IronPython. His first experiment is a Windows Forms SQLite Administrative UI using System.Data.SQLite . The blog entry shows the code: My first venture into IronPython The need for this arises because of the lack of built in encryption in SQLite. There are hooks for creating your own, which is what the people who make the ADO.NET Provider, System.Data.SQLite , did. What this means is that the standard SQLite3 command line utility won't open a sqlite database encrypted using the System.Data.SQLite provider. From what I understand, if I REALLY wanted to, I could get the Provider's source and make it so that the SQLite3 library was NOT compiled into the data provider then I could get the library and probably get an existing UI to use it and all would be fine. But wh...

YAAS 2 (Another Yet Another Awesome Selection)

Another blog entry accreted from only the finest selection of IronPython related blog postings from the last few weeks: A Simple DLR Binder This entry is notable because Dino Viehland (core IronPython developer) has finally written another blog post! This post is on writing DLR binders, a core part of creating dynamic languages that use the Dynamic Language Runtime. DLR binders define the semantics of your language, and Dino explains them along with some C# example code implementing integer addition: There’s a few key pieces you need to understand here. First you’re returning an expression tree back to the DLR to tell the DLR what to do. The DLR will compile this expression tree and run it. You’re also returning a set of restrictions. These will be evaluated by the DLR to see if it can re-use the same code for other objects in the future. You’re unlimited in what you can do with restrictions as they can be arbitrary Expression trees. But here I’m simply restricting based upon th...

Announcing esedb, a dbm interface to the Esent database engine

Laurion Burchall has just posted the following message to the IronPython mailing list: I've added the esedb module (esedb.zip) to the release page of the ManagedEsent CodePlex projec t. This is still under development and I'm interested in comments, feedback and suggestions on how to do things better in Python. What is Esent? Esent is the Windows database engine. It is used by the Active Directory and several smaller applications on Windows clients (e.g. Windows Update). The same code is also used by Microsoft Exchange as their database engine. The unmanaged API is documented on MSDN and there is a managed interop layer on code plex. What is esedb? The esedb module uses the Esent interop layer to provide a persisted key/data store in a dbm-like way. The zip file contains the managed interop DLL and the Python module. The code uses the esent DLL which is part of Windows. This code will work on Windows XP up (it won't work on Windows 2000). That does mean that this module wil...

Simple IronPython Example Using XML, Oracle and SQL Server

From the " Head Above The Clouds Blog ": This is an IronPython example of using .NET classes to load a XML document, query it with a simple XPath expression, and then using the results to transfer data from an Oracle to a SQL Server database. Simple IronPython Example Using XML, Oracle and SQL Server

adodbapi 2.2 ready for IronPython

Vernon Cole announced that with the release of adodbapi version 2.2, it will now run with either IronPython 2.0 or CPython. adodbapi makes it easy to use Microsoft ADO for connecting with databases and other data sources. You can get it at http://sourceforge.net/projects/adodbapi .

ADO.NET with IronPython for ASP.NET

The ARtyProg has posted an example of working with databases (specifically using ADO.NET) with IronPython and ASP.NET. The blog entry is little more than a big code example, but if you're looking for an example of ADO.NET or are getting started with ASP.NET for IronPython it should be useful: IronPython - ADO.NET It's good to see some blog entries of people using IronPython with ASP.NET (Christian has written a great chapter about it in IronPython in Action of course). Personally I feel ambivalent about ASP.NET. Its 'page-by-page' model seems to be fine for simple forms, but not a very good way of creating applications. ASP.NET MVC looks worlds better (Rails and Django even more so of course). On the other hand ASP.NET is massively used (possibly the most widely used web development framework), and people aren't going to switch over to ASP.NET MVC in any great proportion for probably years to come. If they're going to use ASP.NET then they might as well at lea...

Beginning IronPython - Creating a class (Part 3)

ASP.NET IronPython Resource continues the IronPython and ASP.NET tutorial with an introduction to creating Python classes and using them from within ASP.NET. Beginning IronPython - Creating a class (Part 3) " In this tutorial we will be creating a sql table based class for a simple form. It will demonstrate how to create a class and reference it from a form. " " That's it for this tutorial. The next tutorial will go into something practical - creating and updating live data on a form. The code files can be downloaded below. Remember to change the connection string to point to an AdventureWorks database. "

Twining, TwyDL (IronPython DSL)

David Seruyange has been working on his IronPython database DSL Twining . Twining, TwyDL He's been using Twining to export tables to SQL and also working on the ability to generate schema objects: database(cn).create.table("Employees", [ col.ident("EmployeeID"), col.string("FirstName"), col.string("LastName"), col.numeric("Salary") ] )

Python and .NET Playing Together

Another programmer, this time Richard Sumilang, discovers the power of IronPython for using the .NET framework. " And walla! You have to admit, that is pretty awesome! We've got the power of simplicity from Python along with the power of .NET at our finger tips! " In this blog entry he writes two examples in both C# and IronPython, comparing the code in both cases. The first is a simple example to write to stdout (with ' System.Console.WriteLine '), and the second uses the MySQL .NET connector to query a MySQL database. Python and .NET Playing Together

A Front-end for an IronPython DSL

David Seruyange is experimenting with a windows forms front end for Twining , his IronPython DSL for working with databases: Twy, an experimental front-end for Twining

Build your Own Language and IronPython DSL Update

Two new articles: IronPython DSL for Databses Update V - Another update to David Seruyange's IronPython DSL for working with databases. His target is to end up with a DSL that lets him write "database('excel').tables('sheet1').copyto.database('mydb')". DLR - Build Your Own Language - A Bitwise article on using the Dynamic Language Runtime and the ANTLR parser to create your own language.

Django Plays on the Darkside and an MS SQL Provider

At PyCon 2008 Dino Viehland demonstrated Django running on IronPython (with some funky Silverlight communicating with Django via JSON as a bonus). PyCon 2008: Django Now Plays on the Dark Side Dino: IronPython, MS SQL, and PEP 249