带有 Google App Engine 的 iPhone 应用程序

发布于 2024-08-19 03:46:25 字数 389 浏览 3 评论 0原文

我已经设计了一个 iPhone 应用程序的原型,它使用(内部)SQLite 作为其数据库。目的是最终让它通过 PHP 与服务器通信,PHP 将使用 MySQL 作为后端数据库。

然而,我刚刚发现 Google App Engine,但对其知之甚少。我认为使用 Python 接口写入数据存储会很好 - 但我对 GQL 的功能知之甚少。我基本上已经使用 MySQL 编写了所有工作数据库代码,并使用 SQLite 在 iPhone 上进行了内部测试。 GQL 会提供与 SQL 相同的功能吗?我在网站上看到它不支持联接查询。而且真的有关系吗?

基本上我想我的问题是,通常使用 SQL 后端的应用程序是否可以与 Google 的 App Engine 和 GQL 一起工作?

我希望这是清楚的......任何指导都很好。

I've prototyped an iPhone app that uses (internally) SQLite as its data base. The intent was to ultimately have it communicate with a server via PHP, which would use MySQL as the back-end database.

I just discovered Google App Engine, however, but know very little about it. I think it'd be nice to use the Python interface to write to the data store - but I know very little about GQL's capability. I've basically written all the working database code using MySQL, testing internally on the iPhone with SQLite. Will GQL offer the same functionality that SQL can? I read on the site that it doesn't support join queries. Also is it truly relational?

Basically I guess my question is can an app that typically uses SQL backend work just as well with Google's App Engine, with GQL?

I hope that's clear... any guidance is great.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

紫瑟鸿黎 2024-08-26 03:46:25

确实,Google App Engine 是一个非常酷的产品,但数据存储与常规 mySQL 数据库不同。这并不是说 GAE 数据存储无法满足您的需求;而是说,GAE 数据存储可以满足您的需求。但是,您可能需要进行一些修改。

您一开始就注意到的最显着的不同是 GAE 使用对象关系映射作为其数据存储方案。本质上,对象图保存在数据库中,维护其中的属性以及与其他对象的关系。在许多情况下,ORM(对象关系映射)可以很好地映射到关系数据库之上(这就是 Hibernate 的工作原理)。但映射并不完美,您会发现需要进行更改才能保留数据。此外,GAE 有一些独特的限制,使事情变得有点复杂。一个让我很困扰的限制是无法查询属性路径:例如“select ... wheredog.owner.name = 'bob'”。正是这些规则迫使您在开始之前阅读并理解 GAE 数据存储的工作原理。

我认为 GAE 可以很好地适合您的情况。可能需要一些时间来了解一般的 ORM 持久性和具体的 GAE 数据存储。

True, Google App Engine is a very cool product, but the datastore is a different beast than a regular mySQL database. That's not to say that what you need can't be done with the GAE datastore; however it may take some reworking on your end.

The most prominent different that you notice right off the start is that GAE uses an object-relational mapping for its data storage scheme. Essentially object graphs are persisted in the database, maintaining there attributes and relationships to other objects. In many cases ORM (object relational mappings) map fairly well on top of a relational database (this is how Hibernate works). The mapping is not perfect though and you will find that you need to make alterations to persist your data. Also, GAE has some unique contraints that complicate things a bit. One contraint that bothers me a lot is not being able to query for attribute paths: e.g. "select ... where dog.owner.name = 'bob' ". It is these rules that force you to read and understand how GAE data store works before you jump in.

I think GAE could work well in your situation. It just may take some time to understand ORM persistence in general, and GAE datastore in specifics.

ゞ记忆︶ㄣ 2024-08-26 03:46:25

GQL 几乎不提供任何功能;它仅用于 SELECT 查询,并且它的存在只是为了让 SQL 程序员更容易编写 SELECT 查询。在幕后,它将您的查询转换为 db.Query 对象。

App Engine 数据存储区根本不是关系数据库。您可以做一些看起来相关的事情,但我对任何有 SQL 背景的人的建议是不惜一切代价避免使用 GQL,以避免陷入认为数据存储根本就像 RDBMS 的陷阱,并忘记您所了解的有关数据库的一切设计。具体来说,如果你正在使任何事情正常化,你很快就会希望自己没有这样做。

GQL offers almost no functionality at all; it's only used for SELECT queries, and it only exists to make writing SELECT queries easier for SQL programmers. Behind the scenes, it converts your queries to db.Query objects.

The App Engine datastore isn't a relational database at all. You can do some stuff that looks relational, but my advice for anyone coming from an SQL background is to avoid GQL at all costs to avoid the trap of thinking the datastore is anything at all like an RDBMS, and to forget everything you know about database design. Specifically, if you're normalizing anything, you'll soon wish you hadn't.

萌辣 2024-08-26 03:46:25

我认为这篇文章应该对您有所帮助。

摘要:云计算和手持设备软件开发是两项非常热门的技术,它们越来越多地结合起来创建混合解决方案。通过本文,了解如何将 Google App Engine(Google 的云计算产品)与 iPhone(Apple 的移动平台)连接。您还将了解如何使用开源库 TouchEngine,通过连接到 App Engine 云并缓存数据以供离线使用来动态控制 iPhone 上的应用程序数据。

I think this article should help you.

Summary: Cloud computing and software development for handheld devices are two very hot technologies that are increasingly being combined to create hybrid solutions. With this article, learn how to connect Google App Engine, Google's cloud computing offering, with the iPhone, Apple's mobile platform. You'll also see how to use the open source library, TouchEngine, to dynamically control application data on the iPhone by connecting to the App Engine cloud and caching that data for offline use.

无悔心 2024-08-26 03:46:25

这是一个非常普遍的问题:)

简短的回答:是的。这将涉及对您的数据模型的一些重新思考,但是,是的,变化是您可以使用 GAE 数据存储 API 支持它。

当您创建 Python 模型(将其视为表)时,您当然可以定义对其他模型的引用(因此现在我们有了外键)。当您选择此模型时,您将返回引用模型(非常类似于联接)。

它很可能会起作用,但它并不是 mySQL 服务器的替代品。

That's a pretty generic question :)

Short answer: yes. It's going to involve some rethinking of your data model, but yes, changes are you can support it with the GAE Datastore API.

When you create your Python models (think of these as tables), you can certainly define references to other models (so now we have a foreign key). When you select this model, you'll get back the referencing models (pretty much like a join).

It'll most likely work, but it's not a drop in replacement for a mySQL server.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文