dbal

Doctrine2 DBAL Exists query

删除回忆录丶 提交于 2021-02-10 06:34:22
问题 I would like to ask for your help with Doctrine2 DBAL query built with QueryBuilder . I'm used to ORM, but I think it's an overkill for such query which is being called in a listener. I need a query with SELECT EXISTS and I don't know how I can construct it using DBAL QueryBuilder . I have a subquery already created: $subQuery = $connection->createQueryBuilder(); $subQuery ->select('o.id') ->from('order', 'o') ->leftJoin('o', 'payment', 'p') ->where($subQuery->expr()->isNull('p.id')) ; I

四两拨千斤!深度主动学习综述2020

只愿长相守 提交于 2021-01-20 11:25:04
点击上方 “ 机器学习与生成对抗网络 ”,关注"星标" 获取有趣、好玩的前沿干货! 推荐阅读: 弱水三千,只取你标!AL(主动学习)结合GAN如何? 本文转载自知乎,为最近新出的论文 A Survey of Deep Active Learning 中文版介绍,原文作者调研了189 篇文献综述了深度主动学习的进展。文章较长,建议先收藏再阅读。 https://zhuanlan.zhihu.com/p/218011458 论文地址: https://arxiv.org/pdf/2009.00236.pdf A bstract 主动学习试图通过标记最少量的样本使得模型的性能收益最大化。而深度学习则对数据比较贪婪,需要大量的数据供给来优化海量的参数,从而使得模型学会如何提取高质量的特征。近年来,由于互联网技术的快速发展,使得我们处在一个信息洪流的时代,我们拥有海量的未标记数据。 借此,深度学习引起了研究人员的强烈兴趣,并且得到了快速的发展。和深度学习相比,研究人员对于主动学习的研究兴趣相对较低。这主要是由于在深度学习兴起之前,传统的机器学习所需要的标注样本相对较少。因此,早期的主动学习很难体现出应有的价值。尽管深度学习已经在各个领域取得了突破性进展,但是这绝大部分的成功都要归功于现有的大量标注数据集的公开。 然而,大量高质量的标注数据集的获取需要消耗大量的人力

laravel使用Schema创建数据表

北城以北 提交于 2020-04-27 02:27:34
1、简介 迁移就像数据库的版本控制,允许团队简单轻松的编辑并共享应用的数据库表结构,迁移通常和Laravel的schema构建器结对从而可以很容易地构建应用的数据库表结构。如果你曾经告知小组成员需要手动添加列到本地数据库结构,那么这正是数据库迁移所致力于解决的问题。 Laravel 的Schema门面提供了与数据库系统无关的创建和操纵表的支持,在 Laravel 所支持的所有数据库系统中提供一致的、优雅的、平滑的API。 2、生成迁移 使用 Artisan 命令make:migration来创建一个新的迁移: php artisan make:migration create_users_table 新的迁移位于database/migrations目录下,每个迁移文件名都包含时间戳从而允许 Laravel 判断其顺序。 –table和–create选项可以用于指定表名以及该迁移是否要创建一个新的数据表。这些选项只需要简单放在上述迁移命令后面并指定表名: php artisan make:migration create_users_table –create=users php artisan make:migration add_votes_to_users_table –table=users 如果你想要指定生成迁移的自定义输出路径,在执行make

Symfony2 doctrine connect to database via SSL

北慕城南 提交于 2020-01-05 03:37:26
问题 Trying to connect to my MySQL database via SSL, I have successfully established the connection from my webserver via ssh with the following command line: mysql -h my.host.here --port=5454 -v --ssl-ca=/etc/apache2/ssl/mysql/ca-cert.pem --ssl-cert=/etc/apache2/ssl/mysql/client-cert.pem --ssl-key=/etc/apache2/ssl/mysql/client-key.pem -u user -p However, trying to set up the same connection in symfony2 and doctrine, all I keep getting is an "SSL error" $params = array( 'driver' => 'pdo_mysql',

Enabling Doctrine DBAL commands in Symfony app/console

僤鯓⒐⒋嵵緔 提交于 2020-01-01 05:46:06
问题 When using bare-bone Doctrine with the command line that comes out of the box there are two commands available that don't seem to be available with using Doctrine with Symfony and the app/console : dbal dbal:import Import SQL file(s) directly to Database. dbal:run-sql Executes arbitrary SQL directly from the command line. Is there a way to enable these commands within Symfony's app/console ? 回答1: I found a workaround for this, as you may call it that, or maybe rather just a way to enable the

Missing insert() method on Doctrine DBAL Query Builder

做~自己de王妃 提交于 2019-12-31 00:57:06
问题 I feel like I'm having a moment where I'm missing something small here; I've been having issues using the insert() method on the QueryBuilder component on Dotrine DBAL 2.2.x / 2.3.x. I did some investigation and here's the snippet from the QueryBuilder page from the DBAL Documantation The \Doctrine\DBAL\Query\QueryBuilder supports building SELECT, INSERT, UPDATE and DELETE queries. Which sort of query you are building depends on the methods you are using. It goes on further to explain code

Autowire specific DBAL connection when using multiple of them

心已入冬 提交于 2019-12-24 08:24:09
问题 I'm using Doctrine 2 where I have multiple connections for DBAL. I have also multiple EntityManagers in ORM. I need to be able to somehow autowire specific DBAL connection into other Symfony 3 services. I can autowire any EntitiyManager using EntityManagerDecorator but don't know how to do the same with connection. I'm able to get the connection from EntityManager but I don't think it's the way to go. 回答1: You can specify wrapper class for doctrine connections, no proxy class needed: #config

Doctrine DBAL: Updating timestamp field with 'NOW()' value

随声附和 提交于 2019-12-13 00:29:13
问题 Using Doctrine DBAL, I have some code that inserts a new row into the main database from a form values binded as $telephone_international and $surname . After that is done, it inserts a new record into a duplicate database. $app['dbs']['backup'] If that's successful, the entry inserted previously the main database gets its copied value updated. The copied column is a timestamp, default value is 0, but the following code should change it to the current time. $app['dbs']['main']->update(

Getting doctrine dbal is null on app initialization

北城余情 提交于 2019-12-11 16:17:11
问题 I was using Authentication success handler to populate some values on session on every success login. I wanted some database operation to be done so i pass @doctrine.dbal.default_connection from my config file. Here is my config file where i override success_handler function. services: security.authentication.success_handler: class: XYZ\UserBundle\Handler\AuthenticationSuccessHandler arguments: ["@security.http_utils", {}, @doctrine.dbal.default_connection] tags: - { name: 'monolog.logger',

DBAL - symfony2 bind a value for LIKE operator

青春壹個敷衍的年華 提交于 2019-12-11 05:31:56
问题 I am trying to execute a sql query that involves a LIKE operator with DBAL Basically my query is the following: public function getSubsiteByHostname($host){ $sql = "SELECT A.id, A.title, A.layout_id FROM sites AS A LEFT JOIN layouts B ON A.layout_id = B.id WHERE A.baseurl LIKE '%:host%' "; $stmt = $this->db->prepare($sql); $stmt->bindValue("host", $host); $stmt->execute(); return $stmt->fetch(); } SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax;