Does anyone know how to use phpcassa for cassandra with Yiiframework?
I've tried Cassandra PDO. It works very well, but I happened to like the way phpcassa works. Especially the support for most cassandra features.
I don't know but I found phpcassa much easier to use.
Any suggestions?
Regards
I'm not familiar with Yii in particular, but after glancing at it, I suspect you won't be able to use most of the Yii ORM-like features directly, whether it's though phpcassa or the PDO driver. Certainly it could work for some cases, but in general, your data in Cassandra is not modeled around objects, it's modeled around queries. Your goal is to lay out your data in such a way that you can answer queries that you have planned for very efficiently. Because Yii is object-oriented, there's a fundamental mismatch in how it expects you to interact with the database.
I've written an Yii extension today for cassandra-cql3, hope this might help others searching for an yii wrapper for cassandra CQL3
https://github.com/masumsoft/yii-cassandra-cql3
Related
I'm new to Cassandra and I'm looking for the best way to integrate it with PHP.
As always there are many clients but it looks like most of them are not being supported. From what I've seen the most up to date is PHPCassa, unfortunately it doesn't look like it was designed for CQL (which as I understand is the preferable way to talk to Cassandra).
Cassandra-PDO looks interesting because it's using PDO abstraction, and I can (probably?) use high level libraries like Doctrine or Propel with it. Unfortunately the last commit was pushed about 2 years ago and it was very difficult to compile it (to be fair, it was probably a Mac / Thrift issue). I'm always very paranoiac about building something around "rusty" projects, so my question is:
Is it safe to use Cassandra-PDO with Cassandra 2.x? If it's not a good idea should I forget about CQL and go for PHPCassa or perhaps there is another solution?
This might help: https://github.com/Orange-OpenSource/YACassandraPDO
"This repository is a fork of:
https://code.google.com/a/apache-extras.org/p/cassandra-pdo/ We cloned
it on GitHub because the original project seemed to be dead.
This version is developped for the CQL3 target only. We do not provide
any support for former versions of CQL."
HTH,
Carlo
To my knowledge YACassandraPDO not stable.
Please check this PHP library http://evseevnn.github.io/php-cassandra-binary/
It is written by me, and how to work with it is similar to the PDO wrapper. Maybe it will suit you.
i wonder, is there a way to work with SQLite on PHP version 4.2.3 ?
if you say i must update my php version, no i can't simply update my PHP version.
the system already have database, but i can't change that database it's not my authority though i can view, edit, or do anything to that database.
so i think maybe it's easier if i use my own sqlite database and make my own function to deal with the sqlite database, but i don't know if it supported by PHP version 4.2.3
thanks, any suggestion would be a great lift.
For what I found, yes, is possible to have sqlite under php4.
http://www.phpbuilder.com/columns/farell20040824.php3?page=1
http://polarwebservices.com/hostingblog/?p=6
http://forums.cpanel.net/f5/howto-install-sqlite-php4-servers-59201.html
And the source code of the sqlite extension is here: http://pecl.php.net/package/SQLite
Keep in mind is no longer supported, and is sqlite2 instead of sqlite3.
But if you are still using php4 on this year, I don't think you would really mind using an old sqlite, right? :P
By the way, IMHO, if that application makes you money, I think you should at least spend some time updating it.
I'm faced with a similar situation being stuck with PHP4. And I know where you're coming from (switching is much easier said than done specially if it's your own money you're spending).
But it's not the end of the world. Like you I needed to integrate newer technologies to my app. So what I did was instead to run 2 PHP versions along-side each other and created an API that I access via curl from PHP4.
That's the simplest approach I can think of. Hope that helps. I feel you man hehehe...
I'm trying to plan a web application that should use a noSQL solution - Cassandra seems to be a good solution. I saw there are libraries for PHP to manipulate the database like phpCassa.
Also I saw the new version of Cassandra 0.8 is introducing a query language CQL.
Are there php interfaces that use the CQL? What is the benefit using the CQL? Is it just a more sql-like way to make queries?
Thank you!
The link Greg posted above is to date the working repo and state of the php-cql driver efforts.
While a driver is not yet available it does not stop you from using CQL, the drivers are all going to be a wrapper of the thrift method "execute_cql_query" (Until a new transport is created anyway).
That means you can simply compile thrift for php or get it from an updated project and then pass your cql query to that method. It does mean manual handling of things that a driver will/should take care of.
"Is it just a more sql-like way to make queries?", basically...yes. One of the things that came up on the Cassandra mailing list was getting CQL to be as SQL-Like as possible.
"What is the benefit using the CQL?" Well, mainly that some new Cassandra users find the thrift API tedious to get to grips with, CQL may be much easier to learn since its is so close to the "normal" sql.
https://github.com/nicktelford/php-cql
I also believe that phpCassa should support it as well.
It's designed to make NoSQL more logical for people coming from SQL as a database engine.
This will really be helpful if you wish to use CQL to communicate with Cassandra via PHP
https://gist.github.com/1024060/983a5607390433b77d5c2e64a4ee148f4df46b69
This is a sample of what zcourts mentioned in his previous post
Regards,
Tamil
The official CQL drivers supported by the Apache Cassandra project at large are, I believe, all on Apache Extras, at this link:
http://code.google.com/a/apache-extras.org/hosting/search?q=label:cql
The PHP one is at
http://code.google.com/a/apache-extras.org/p/cassandra-pdo/
Connection via Thrift deprecated.
I am using PHP library for Cassandra database via a binary protocol.
What DB extension PHP has (mysqli, PDO etc) is the best for enterprise level application?
The important features that comes to my mind are:
under active maintenance
A lot of documentation and examples.
Probably endorsed by the Mysql people themselves.
Robust
scalable
1. under active maintenance
mysqli and PDO. if you end up using a framework, it will probably be using mysqli anyway.
2. A lot of documentation and examples.
mysqli and PDO.
3. Probably endorsed by the Mysql people themselves.
mysqli. see http://dev.mysql.com/doc/refman/5.0/en/apis-php.html
4. Robust
if i had to point to 1 single PHP extension that answers the question "which one is used most often and has the most number of people scrutinizing it for bugs?", i would have to vote for mysqli. if you have a different definition of robust, you'll have to elaborate.
5. scalable
it depends what you mean by scalable. in the mysqli vs. PDO shootout, mysqli has the tightest codebase and is therefore more scalable simply because the code is lighter. YMMV. IANAL.
but if you want something that helps you to scale (such as distributing load across a couple of mysql servers) you'll need something to wrap mysqli/PDO because nothing at the mysqli/PDO/whatever level will do this for you.
Real enterprise applications require not only a database extension, but ORM. I've heard sth about Doctrine, but can't tell you if it's stable, because I haven't used it.
I've looked at the features that it offers and it seems that this project is there for a while, because it has support for lazy loading, many-to-many relationships, inheritance, which are features that most of new ORMs don't have.
Almost all of free web hosting server,
you can not use PDO + MySQL.
They lack PDO drivers.
So I am considering to select
pear MDB2,
or DB_DataObject.
Which do you reccomend to me?
Give me your opinions!
I would actually recommend using the Mysqli functions if you can. They are fast, well-documented and well supported by the php community at large.
If you are looking for a more robust database abstraction layer, I would first suggest that you look at any of the excellent library's out there like DataMapper, or Propel or Doctrine, or even using the necessary portions of a framework like Zend. As further note, I've used Adodb in the past, but haven't seen much support for it recently.
I've used MDB2 quite a bit but have found the built-in mysqli functions to be fast and easy-to-use, plus they can integrate easily into a roll-your-own db abstraction layer.
DB_DataObject depends on MDB2, so you have to have it anyway.
The question is : do you need just bare database independence or more advanced ORM (that's DB_DataObject).
I'd suggest you stick with MDB2 since you seem confused about this stuff.
You can use DB_DataObject with MDB2 without problems.
ADOdb is also good.
The PHP version currently supports an amazing number of databases, thanks to the wonderful ADOdb community: MySQL, PostgreSQL, Interbase, Firebird, Informix, Oracle, MS SQL, Foxpro, Access, ADO, Sybase, FrontBase, DB2, SAP DB, SQLite, Netezza, LDAP, and generic ODBC, ODBTP. The Sybase, Informix, FrontBase and PostgreSQL, Netezza, LDAP, ODBTP drivers are community contributions.