const { Client } = require('pg');
require('dotenv').config({ path: '../.env' });
const client = new Client({
    host: process.env.DB_HOST,
    port: process.env.DB_PORT,
    user: process.env.DB_USER,
    password: process.env.DB_PASSWORD,
    database: process.env.DB_NAME
});
client.connect().then(async () => {
    try {
        const res = await client.query('SELECT count(*) FROM geodaten.flaecheneigentuemer_status WHERE projekt_id = \'5bb4e049-85f2-4433-b38e-6a66b81e9f06\'');
        console.log('Status count for bw_samern-ohne: ' + res.rows[0].count);
        
        const sample = await client.query('SELECT * FROM geodaten.flaecheneigentuemer_status WHERE projekt_id = \'5bb4e049-85f2-4433-b38e-6a66b81e9f06\' LIMIT 5');
        console.log('Sample entries:');
        console.table(sample.rows);
    } catch (e) {
        console.error(e);
    } finally {
        client.end();
    }
});
