Showing entries 291 to 300 of 378
« 10 Newer Entries | 10 Older Entries »
Displaying posts with tag: Python (reset)
451 CAOS Links 2010.01.21

EC approves Oracle-Sun. Google patents MapReduce. And more.

Follow 451 CAOS Links live @caostheory on Twitter and Identi.ca
“Tracking the open source news wires, so you don’t have to.”

EC approves Oracle-Sun

The European Commission cleared Oracle’s proposed acquisition of Sun Microsystems. While Larry Ellison is set to unveil Oracle’s Sun strategy on January 27th, Monty Widenius said he will go to the Court of First Instance to appeal the decision.

# Pro-open source political party formed in Hungary.

# Google …

[Read more]
kajtajm: Planning my first Python / PyObjC / MySQLdb project

Never have I planned a program so much in detail before starting coding. And stranger still, I’m planning the program to be coded in a language in which I haven’t written a single line of code. Nonetheless, I’m eager and it feels good.

I woke up early this Sunday, my mind concentrating on the many steps I will have to take before the first project will see the light of day. I had planned eight prerequisite lessons before even starting the coding. And despite receiving many good pieces of advice, nobody had relieved me of my main worry — the input grid for the data entry in matrix format.

To speed up things, I thought of writing some auto-generated INSERT statements from the current Google Spreadsheet that I’ve been using. I would then at least have the basic data from the first two weeks of the year to play around with in my MySQL database.

And then it struck me: I don’t need a grid at …

[Read more]
Rediscovering Programming with Python, Cocoa and PyObjC

Use PyObjC to code Python under the Mac Cocoa framework, and MySQLdb to interface with MySQL! That’s the advice I got in reply to my recent blog. The discussions were so inspiring that I spent all time when out running yesterday daydreaming about how wonderful it will be to rediscover the aesthetics of programming and regain the control over my personal IT.

So, to recap a bit of my thinking: Once a programmer, always a programmer. If you’ve learned how to code and to master your own IT life to a certain degree, you get used to it. At least I did. But then fate wrote a declaration of incapacity for me. Not only did I become a manager and got to do less and less coding. More aggravatingly, I changed operating systems. Gone …

[Read more]
Purging binary logs.

Being a MySQL DBA , one faces a common issue in replication environment -> Disk space issue on master, since the number of binary logs have increased. Now, one of the solution to this would be using expire_logs_days parameter in your mysql config file. But what if, the slave is lagging by few hours or if the slave is broken since few days and the binary logs are removed due to the parameter set. Whenever the salve comes up, it will go bonkers, knowing that the binary log where it last stopped no more exists.
I faced this issue a couple of times until I decided to automate it using a script. Herewith I am attaching the URL to my python script which can run regularly in cron. Features :

  • Checks the slaves connected to the master (I have limit it to 3 for now.)
  • Checks the last binary log file which is being used by the slave.
[Read more]
Going chemical: SQLAlchemy and MySQL Connector/Python!

Last week I took SQLAlchemy v0.6 out of its trunk and tested it again with our MySQL Connector/Python. And surprise! SQLAlchemy comes with a 'dialect' supporting it! Nice!

However, we're still a long way on making it work. I found some additional problems which need to be fixed first.


shell> nosetests --dburi=mysql+mysqlconnector://root:@localhost/sqlalchemy \
test/dialect/test_mysql.py
..
Ran 32 tests in 4.507s

FAILED (errors=6, failures=1)

Oh, there were more errors and failures and all that due to bugs in MySQL Connector/Python. There were …

[Read more]
A chessboard in MySQL

Something to keep you warm during cold winter nights, or cool during hot summer days: a chessboard in MySQL!

Note: You should see chess pieces here below. If not, you're not watching it using UTF-8, or get yourself a good browser!


CREATE TABLE `chessboard` (
`x` tinyint unsigned NOT NULL,
`a` enum('','♔','♕','♖','♗','♘','♙','♚','♛','♜','♝','♞','♟'),
`b` enum('','♔','♕','♖','♗','♘','♙','♚','♛','♜','♝','♞','♟'),
`c` enum('','♔','♕','♖','♗','♘','♙','♚','♛','♜','♝','♞','♟'),
`d` enum('','♔','♕','♖','♗','♘','♙','♚','♛','♜','♝','♞','♟'),
`e` enum('','♔','♕','♖','♗','♘','♙','♚','♛','♜','♝','♞','♟'),
`f` enum('','♔','♕','♖','♗','♘','♙','♚','♛','♜','♝','♞','♟'),
`g` …
[Read more]
Using character sets with MySQL Connector/Python

Here is two small examples showing the wonderful world of character sets and unicode using MySQL Connector/Python (using 0.1.2-devel and up) in both Python v2.x and v3.1.

The following table will be used with default character set latin7, i.e. ISO-8859-13. Just setting it to UTF-8 would be bit boring!


CREATE TABLE `latin7test` (
`c1` varchar(60) DEFAULT NULL
) DEFAULT CHARSET=latin7

Things to note for the code listed below are:

  • We're using charset='latin7' as connection option. This is important!
  • We set use_unicode=True so the results coming from MySQL are encoded to unicode. For testing, we disable this later.
[Read more]
MySQL Connector/Python 0.1.2-devel available!

MySQL Connector/Python 0.1.2-devel is a quick follow-up release for 0.1.1 fixing a few problems around character sets and unicode.

You can download Connector/Python from LaunchPad.

Release notes for MySQL Connector/Python 0.1.2-devel


o Fixing unicode usage for both Python 2.4+ and 3.1
* Setting 'use_unicode' at connection time is now
working.
* conversion.py: removing regular expression for
quoting backslashes.
* Adding test case for bug lp:499410

Py3k specific:
* Strings from MySQL are decoded to the given character
when use_unicode is false
* The statement is encoded just before sending it to the
MySQL server. Internally, all is done in unicode. …
[Read more]
MySQL with Python v3.1 now also possible using MySQL Connector/Python

The second development release of MySQL Connector/Python comes with support for Python v3.1!

I thought of making two distributions of MySQL Connector/Python, but then it would have been messy with versions and packaging. So what you get now is 2-in-1 and the installation script should be smart enough to figure it out.

Please, if you find any issues, bugs or have suggestions: report them here https://bugs.launchpad.net/myconnpy

Download

From LaunchPad!

Release notes


Added Python v3.1 support
* The subdirectory/module py3k/ contains Connector/Python compatible
with Python v3.1.1.
* setup.py will install the correct Connector/Python distribution
depending on …
[Read more]
MySQL Replicant: a library for controlling replication deployments

Keeping a MySQL installation up and running can be quite tricky at times, especially when having many servers to manage and monitor. In the replication tutorials at the annual MySQL Users' Conference, we demonstrate how to set up replication appropriately and also how to handle various issues that can arise.

Many of these procedures are routine: bring down the server, edit the configuration file, bring the server up again, start a mysql client and add a user, etc.

It has always annoyed me that these procedures are perfect candidates for automation, but that we do not have the necessary interfaces to manipulate an entire installation of MySQL servers.

If there were an interface with a relatively small set of primitives—re-directing servers, bringing servers down, add a line to the configuration file, etc.—it would be possible to create pre-canned procedures that can just be executed.

To that end, …

[Read more]
Showing entries 291 to 300 of 378
« 10 Newer Entries | 10 Older Entries »