Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stereoflo/dbal-clickhouse
doctrine dbal layer for clickhouse.
https://github.com/stereoflo/dbal-clickhouse
clickhouse dbal symfony
Last synced: about 1 month ago
JSON representation
doctrine dbal layer for clickhouse.
- Host: GitHub
- URL: https://github.com/stereoflo/dbal-clickhouse
- Owner: StereoFlo
- Created: 2021-12-03T15:26:05.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2021-12-09T18:49:07.000Z (almost 3 years ago)
- Last Synced: 2024-10-13T06:22:01.062Z (about 1 month ago)
- Topics: clickhouse, dbal, symfony
- Language: PHP
- Homepage:
- Size: 467 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Installation
```
composer require stereoflo/dbal-clickhouse
```## Initialization
### Symfony
configure...
```.dotenv
# .env
CLICKHOUSE_HOST=127.0.0.1
CLICKHOUSE_PORT=8123
CLICKHOUSE_USER=default
CLICKHOUSE_PASSWORD=
``````yml
# config/packages/doctrine.yaml
doctrine:
dbal:
dbname: default
host: '%env(resolve:CLICKHOUSE_HOST)%'
port: '%env(resolve:CLICKHOUSE_PORT)%'
user: '%env(resolve:CLICKHOUSE_USER)%'
password: '%env(resolve:CLICKHOUSE_PASSWORD)%'
driver_class: DBALClickHouse\Driver
wrapper_class: DBALClickHouse\Connection
options:
enable_http_compression: 1
max_execution_time: 60```
...and get from the service container
```php
private Connection $connection;public function __construct(Connection $connection)
{
$this->connection = $connection;
}/**
* @return array>
*/
public function getByUserId(int $userId): array
{
$result = $this->connection
->createQueryBuilder()
->select('user.user_id')
->from('users', 'user')
->where('user.user_id = :user_id')
->setParameter('user_id', $userId)
->executeQuery();return $result->fetchAllAssociative();
``