Post tagged: sqlalchemy

20 Lines of Python

Querying a Database and POSTing data in 20 lines

I love Python and its many libraries. The HTTP library by the name of requests is particularly awesome.

Note: I have not used any authentication, basic or otherwise, but it's easy enough to add.

StringIO is used because the cvs library …

Persistence With SQLite

The Problem-ette

I needed to keep track of up until where in a database table I had already queried. Later queries needed to draw data from that point onwards. For example if I've done the query select id, name, surname from table where id > 255623 and it yielded results with …

SQL Converter

The Problem

I had a text file containg MS SQL Server database table definitions and I needed to make it compatible with MySQL. Here’s an example:

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Blecchs]') AND type in (N'U'))